Using Gii and crud I can setup the basics. I know how to use relational data, so I can display the category name on the book details page, and link from there to the specific category.
What I would like it to display the book list under the category details view. So if I open the category list and click on a category (e.g. fiction), the fiction view should display (a) the fiction details (category id, name), and below a list of fiction books, with links to the book details views.
Is there a tutorial somewhere that can teach me setting this up?
You can do it as in view.php of the category views
$books=Books::model()->findAllByAttributes(array(
'category_id'=>$model->id // $model= category model
));
// or if you have book as relation in category
$books=$model->book
// then do as
if($books){
foreach($books as $book){
echo 'Name : '.$book->name;
}
}