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

    I am listing the books of an author in the show tpl. How can I add the link to edit for each book in view/author/show.tpl .
    I have $app_helpers = 'book'; in my application_controllers.
    And when i use
    {loop book.authors}

    the link is to edit an author with the specified books ID.

    How can I fix this. I really
    need help
    • CommentAuthormetkelb
    Im sorry I have it backwards

    the code i am using is

    {loop author.books}

    And the link i get is : ?ak=/author/edit/2/
    Im trying to get this: ?ak=/book/edit/2/

    BTW, the id is the correct one
    • CommentAuthorinsanet

    you need to specify the controller in the helper, look for this:

     array('action' => 'edit', 'id' => $record->getId()

    change to this:

     array('controller'=>'book','action' => 'edit', 'id' => $record->getId()

    if you dont specify the controller the helper use the current one.

    • CommentAuthormetkelb
    Thank you very much for the reponse,

    It works, but im sure you knew that already
    • CommentAuthorGKSR
    I need some help, I have two controllers(owner and option).

    After adding a owner,
    $this->redirectTo(array('controller' => 'option', 'action' => 'add', 'id' => $this->Owner->getId()));
    the page will be redirected to option add(/vra/option/add/28/ or /vra/option/add/?back=28).

    I want the owner id( say for ex:28) to be in option helper,
    function back($url = array('controller' => 'owner', 'action' => 'edit', 'id' => $record->getId())) //line 15. here the id value should be 28
    return '<input type="button" class="primary" value="'.$this->_controller->t('Back to previous page').'" style="width: auto;" onclick="window.location.href = \''.$this->_controller->urlFor($url).'\';" />';

    when i do this, I am getting an error:
    Parse error: syntax error, unexpected T_VARIABLE in C:\xampp\htdocs\vra\app\helpers\option_helper.php on line 15

    The purpose is, when i click the "back to previous page' button(in /vra/option/add/), it should go back to owner edit (/vra/owner/edit/28/)

    How can I achieve this?
    • CommentAuthorinsanet


     function back($url = array('controller' => 'owner', 'action' => 'edit', 'id' => $record->getId())) 

    mmmmm, thats not gonna work, $record is supposed to be an object. that is usually used when looping collections. just use $id

     function back($url = array('controller' => 'owner', 'action' => 'edit', 'id' => $id))
    • CommentAuthorGKSR
    It's not working.

    when i reach this page(http://localhost/vra/option/add/40/),

    I am getting the same error,
    Parse error: syntax error, unexpected T_VARIABLE in C:\xampp\htdocs\vra\app\helpers\option_helper.php on line 15.

    function back($url = array('controller' => 'owner', 'action' => 'edit', 'id' => $id)) //line 15
    • CommentAuthorinsanet

    oops, i forgot to mention that also this is invalid php code:(you cant declare arguments inside arguments)

      function back($url = array('controller' => 'owner', 'action' => 'edit', 'id' => $id)){  //<-- invalid code

    just leave it as if it was at the beginning:

       function  back($url = array('controller' => 'owner', 'action' => 'edit')){

    and use it like

       $your_helper->back(array('controller' => 'owner', 'action' => 'edit','id'=>$id));