What I want to do is display the description instead of the category_id in the content view. What I tried to do is use the find method to extract the description column and then display it.
in content model:
public function getCategory($category_id)
{
//this function returns the description field from one record
$criteria = new CDbCriteria;
$criteria->select='description'; // only select the 'description' column
$criteria->condition='id='. $category_id;
$criteria->params=array(':id'=>$category_id);
return Category::model()->find($criteria);
}
The error message I am getting when I try to display the view file:
"htmlspecialchars() expects parameter 1 to be string, object given"
Is there another way I should be trying to display the information returned from my function instead of Chtml::encode or is my function designed incorrectly?