Not signed in (Sign In)
Welcome Guest!
Want to take part in these discussions? If you have an account, sign in now.
If you don't have an account, apply for one now.
    • CommentAuthorrkirkw
    • CommentTimeNov 29th 2007 edited
     

    I got all the way through the booklink tutorial and got it all to work except getting the authors to show up with the books I got the part where I get the Author drop down when creating the book and can see them properly stored in the database with the books

    I am using the tutorial from: http://www.akelos.org/docs/tutorials/booklink

    Seems like something wrong in the app/views/book/show.tpl Did I not put the _{Author} line in the right place?

    <div class="show">
        <?php  $content_columns = array_keys($Book->getContentColumns()); ?>
        <label>_{Author}:</label> <span class="static">{book.author.name?}</span><br />
        {loop content_columns}
            <label><?php  echo  $text_helper->translate($text_helper->humanize($content_column))?>:</label> 
            <span class="static"><?php  echo  $book->get($content_column) ?></span><br />
        {end}
    </div>
    

    If it matters, here is my PHP version info php -v

    PHP 5.2.4 (cli) (built: Sep 18 2007 08:50:58)

    Copyright (c) 1997-2007 The PHP Group

    Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies

    I am running on Fedora 7

    Thanks!

    • CommentAuthorrkirkw
    • CommentTimeNov 29th 2007
     
    Ok - wow am I an Akelos newbie

    The individual books show the Author: from <label>_{Author}:</label> <span class="static">{book.author.name?}</span><br />

    I was expecting the book overview to show something like:

    Author1
    book
    book
    book
    Author2
    book
    book

    That would be in the listing.tpl I think

    Any ideas on how to do this?

    Thanks for a cool tool - 3rd day in so far
    • CommentAuthorKaste
    • CommentTimeNov 29th 2007
     

    Author1 book book Author2 book [...]

    ? the same two models seen from the other side.

    in the controller:

    $this->authors =& some author-finder including the Books.
    

    in the view:

    {loop authors}
    

    and in this loop

    {loop author.books}
    

    clearer? wrong direction?

    • CommentAuthorrkirkw
    • CommentTimeNov 30th 2007
     
    As you can see here http://forum.akelos.org/discussion/110/how-to-add-author-to-the-book-listing-in-the-booklink-tutorial/#Item_2
    I figured out how to get the author to show up like
    Author1 book1...
    Author1 book2...
    Author2 book3
    Author2 book4

    My problem now is the listing is sortable by book title, description, published on, created at, updated at but not Author

    I can see in app/views/book/listing.tpl where that takes place with the $pagination_helper->sortable_link <tr>
    <th>_{Author} </th>
    <?php $content_columns = array_keys($Book->getContentColumns()); ?>
    {loop content_columns}
    <th scope="col"><?php echo $pagination_helper->sortable_link($content_column) ?></th>
    {end}
    <th colspan="3" scope="col"><span class="auraltext">_{Item actions}</span></th>
    </tr>

    I have tried unsuccessfully to incorporate the $pagination_helper->sortable_link in with the <th>_{Author} </th>

    Any ideas here?

    Thanks!
    • CommentAuthorKaste
    • CommentTimeNov 30th 2007
     

    order by a foreign attribute (author.name) is not supported by the paginator-helper.

    you have to do it by hand. modify the getFinderOptions and sortable_link

    as always: if you find a pattern, share it!

    I would like to see a refactored paginator that works more on the level of a model, as a model-extension, because a paginator only restricts the result-set of a find*

    a paginator-helper then would only spit out the usual links

    • CommentAuthorrkirkw
    • CommentTimeDec 4th 2007
     
    For now, I came up with a "brute force" method of getting the listing screen to be sorted by author
    I simply put a link back to the original page of booklink/book in the header with the Author
    <th> <a href="/booklink/book" title="Sort by Author (Id)"> _{Authors} </a> </th>

    I think the _{Authors} sintag may be a bit redundant at this point but at least it sorts the display back in the order of the Author ID's without having to leave the page
Add your comments
    Username Password
  • Format comments as