Akelos Framework v1 forum archive. This forum is no longer maintained. To report bugs please visit https://github.com/akelos/akelos/issues
    • CommentAuthornextstep
     
    Hi there,

    I'm getting there, one of the reasons for sticking with Akelos, is the inheritance from Ruby on Rails.

    Ok, now for some questions ...

    1) How can I limit the number of columns being displayed in the listing views?

    2) Where would be the best place to add header and footer sections?

    3) How can I include two listings (each from a separate table) on a single page?

    thanks!

    Johan
    • CommentAuthornextstep
     
    Some feedback - I've managed to sort issues #1 and #2, number 3 is still problematic ...

    thanks
    • CommentAuthorKaste
     

    3) How can I include two listings (each from a separate table) on a single page?

    using partials.

    the default add.tpl uses

    <?php  echo   $controller->renderPartial('form') ?>
    

    can be rewritten using sintags

    <%= render_partial 'form' %>
    <%= render_partial 'path/form' %> 
    

    !path is relative to the views path !

    you can pass a variable like

    <%= render_partial 'form', :var => Books %>
    

    or something like this. etc...

    there are different opinions of how to get the data of two models and especially where to locate the 'logic' - some think getting data is very 'busy business' - though.

    you can do it in the view, in a before-filter in the controller. dadadum etc.

    • CommentAuthornextstep
     
    Kaste,

    Thanks for the help, that will surely do the trick (presume it would work in the listing pages as well).

    Would one use partials for the headers and footers, or is there a better solution?

    thanks,

    Johan
    • CommentAuthorKaste
     

    you said you've managed issues #1 & #2.

    then actually we're having two solutions. your solution and using partials.

    I would like to know your little secret. ;-)

    • CommentAuthornextstep
     
    lol - I thought I had a solution - partials will do just fine, thanks :-)
    • CommentAuthorsuthern
     

    And if anyone else was scratching their head on how to do this in a file inside the layouts directory, remember that the path is relative to the Originating Model's view directory.

    Here's what I did to get a header:
    1. Put a file "header.tpl" in the layouts directory. (It's application wide, so I figured this was a ok place to stick it. Suggestions welcome)
    2. Inside the part.tpl file (Also in the layouts directory), I put this just under the BODY tag: <%= render_partial '../layouts/header' %> I hope that saves someone else a few minutes of loose hair. :-)

    • CommentAuthorKaste
     

    curious.

    <%= render_partial 'layouts/footer' %>
    

    should work

    • CommentAuthorsuthern
     

    Odd, I thought I'd tested yet. Yup, it works fine, and looks better. Why would both work though? Doesn't ../ refer to one directory up the tree?

    • CommentAuthoryixiazi
     
    If you have indeed answered questions 1 and 2 it would be appreciated if you might hint at what the answer was since to not do so just leaves an open ended link with no information for those who haven't figured it out.

    I would like to know how to restrict the returned columns.

    Here is my line to list my columns:

    $content_columns = array_keys($Product->getContentColumns());

    I just tried the following which did not work:

    $content_columns = array_keys($Product->getContentColumns('ItemMaster','ItemDescription'));

    I could not find the function getContentColumns() to study its object properties and methods, nor could I find it documented on the Akelos site. Any pointers how to use it properly?

    ^__^

    -Brian
    • CommentAuthoryixiazi
     
    I discovered the following:

    <?php // $content_columns = array_keys($Product->getContentColumns());
    // I commented out the above line because it just generates a list of column names in a numbered array.
    ?>
    <?php $content_columns = array('itemMasterID','itemDescription');
    // I replaced it with a specific reference
    ?>


    {loop content_columns}
    <th scope="col"> <?php echo $pagination_helper->sortable_link($content_column) ?> </th>
    {end}

    Now only the columns that I want to show in the product listing page show up.

    Awesome.