Akelos Framework v1 forum archive. This forum is no longer maintained. To report bugs please visit https://github.com/akelos/akelos/issues
    • CommentAuthormsalhab
     
    anyone can tell me how to display author's name linked to author's listing for each book after making all of associations
    operation "has_many" and "belongs_to"

    its just a display issue.

    Regards
    • CommentAuthorThijs
     

    linked to author's listing

    Maybe you meant: 'linked to author's edit (or show) page'?

    To do that you would first make a helper function in book_helper

    function link_to_author($linktext,$authorId)
    {
        return $this->_controller->url_helper->link_to($linktext,
                                                       array('controller'=>'author',
                                                             'action' => 'edit',
                                                             'id' => $authorId));
    }
    

    and in the view you would use:

    <?= $book_helper->link_to_author($book->author->name,$book->author->id)?>
    

    (there is probably also a nice Sintags version.. but I don't know it)

    • CommentAuthorThijs
     

    If the authors' names don't already show on your books listing page: make sure you include the authors in the search:

    $this->books =& $this->Book->find('all', array('include' => 'author'));