Akelos Framework v1 forum archive. This forum is no longer maintained. To report bugs please visit https://github.com/akelos/akelos/issues
    • CommentAuthoranagram
     
    Hi guys, i've got another problem here. Well, i've created a new helper called ApplicationHelper (application_helper.php) in app/helpers directory.

    -----------------------------------------------------------------------------------
    <?php

    class ApplicationHelper
    {
    function setElementClass($element) {
    $class = '';
    $helper = new UrlHelper;

    if ($helper->current_page(array('controller' => $element))) {
    $class = 'active';
    }

    return $class;
    }
    }

    ?>
    ---------------------------------------------------------------------------------------------------

    When i called setElementClass, i got this error :
    Undefined property: UrlHelper::$_controller

    I've been stuck for about 1 hour (tracing akelos php source), please could anyone give me solutions?

    Thanks ....
    • CommentAuthorarnoschn
     
    The url helper needs the Controller instance.

    try this, extending the url_helper and reusing its functionality inside.

    class ApplicationHelper extends UrlHelper
    {

    function setElementClass($element) {
    $class = '';


    if ($this->current_page(array('controller' => $element))) {
    $class = 'active';
    }

    return $class;
    }
    }