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

    Hello,

    I wanna make a usermenu in app/view/layouts/default.tpl but if I write

    <?php if (strpos($_SESSION['credentials'], 'manager')): ?>
        ...
    

    I get:

    Catchable fatal error: Object of class AkPaginator could not be converted to string...

    I also tried to make a helper. But all custom helpers are asigned to there views I tried :

    class ApplicationController extends AkActionController 
    {
    
    var $app_helper = 'layout';
    

    and placed an layout_helper.tpl in the helper directory but that also not work

    thanks
    badPussycat

    • CommentAuthorbadPussycat
     

    -

    • CommentAuthormerindol
     

    1/ Replace ":" with "{", like &lt;?php if (strpos($_SESSION['credentials'], 'manager')) { ?> &lt;p>Hi manager!&lt;/p> &lt;?php } ?>

    2/ It's $app_helpers, with a "s"

    P.S: Well, how to avoid those & lt; in code paragraphs?

    • CommentAuthorbadPussycat
     

    hello merindol,

    thank you for your reply, but sadly none of ur advice works no matter if curly brake or colon I got the error from above

    and with the helper approach:

    Notice: Undefined variable: app_helper in /tmp/ak_3d41f04fe922bc8f71eabf180a25acf8/views/app/views/layouts/compiled/forum.tpl.php on line 61
    Fatal error: Call to a member function user_menu() on a non-object in /tmp/ak_3d41f04fe922bc8f71eabf180a25acf8/views/app/views/layouts/compiled/forum.tpl.php on line 61

    thanks
    badPussycat

    • CommentAuthorbadPussycat
     

    P.S: Well, how to avoid those & lt; in code paragraphs?

    I don't know - I'm on a PC and I do nothing special with my "<"

    • CommentAuthormerindol
     

    I'm really not sure about the first error :/

    But for the second one I'll need more code. You should put this in your controller var $app_helpers = 'layout'; Create the helpers/layout_helper.php file that contain class LayoutHelper extends AkActionViewHelper { function user_menu( $param1, $param2 ) { ... return( $something ); } } And in your view, this call &lt;%= user_menu param1_value, param2_value %> (Akelos find by itself that the user_menu function is defined in the layout_helper).

    • CommentAuthorbadPussycat
     

    Hi merindol,

    I've done exactly the same except the view call

    thank you bad Pussycat

    • CommentAuthormerindol
     

    I'm not sure to understand. The view call was wrong and it now works? If it works please edit your first post's subject and add [solved].

    Have fun with Akelos :)

    • CommentAuthorbadPussycat
     

    I've never verified it :) In the meantime I have found another (better,I think) approach. I write in authentication-filter the credential-string from session var to a array . In the views i can do a {?credentials-manager}Hi manager{end} and access in all controllers is easy too. But I think you're right because I had the following view call : <?php echo $app_helper->....

    Thank you Akelos definitely rocks!
    (Now I understand the "Rails-Hype" (a few days ago I bought a book for Rails - but I think ruby will never be my friend :) but it help me with Akelos too (in fact this was the intention for buying this book ;) )

    greetings from germany
    bad Pussycat