Akelos Framework v1 forum archive. This forum is no longer maintained. To report bugs please visit https://github.com/akelos/akelos/issues
    •  
      CommentAuthorTalizmelf
     
    I wanted to know how to put some text, a patial or the code generated by a helper, directly from the controller, without the need of using a view for the action (index in this case). Also how to render this text in the layout using the $content_for_layout variable..

    If anyone can help me... Thanks a lot...
    • CommentAuthorKaste
     

    Currently a bit hick-hacky. You could try

     $this->renderWithALayout(array('text'=>'My text for :content_for_layout'));
     $this->renderWithALayout(array('partial'=>:partial_name));
    

    not tested.

    •  
      CommentAuthorTalizmelf
     
    Oh... thanks a lot... I haven't tried it yet 'cause I was on vacation...
    I'll try it soon and I tell you later how it went.. :)
    •  
      CommentAuthorTalizmelf
     

    Yeah, it's cool but it isn't what I meant...
    I mean, if there is anything like more directly... the closest thing so far is
    $this->renderWithLayout(array('text'=>"what I want to render", 'layout'=>"current_layout"));
    And I don't even know why one have to specify the layout every time, instead of akelos doing it using the current one...
    I guess this will be the way to do it...
    Thanks anyway....

    All help will be appreciated :D

    • CommentAuthorKaste
     

    Thats because render :text by default is implemented as render without a layout.

    But you can always define your own methods, whats the problem?

    function renderTextWithCurrentLayout($text)
        $this->renderWithLayout(array('text'=>$text,'layout'=>$this->getActiveLayout()));
    
    •  
      CommentAuthorTalizmelf
     
    Yeah... that's what I thought...
    Thanks...
    •  
      CommentAuthorTalizmelf
     

    Hi again.. I got some other issues...
    I was testing render functions and I got an error with this statement:

    $this->renderWithLayout(array('template'=>"mytemplate"));
    

    throwing: Fatal error: Call to undefined method TestsController::_getDefaultTemplateName() in C:\xampp\htdocs\akelos_tests\lib\AkActionController.php on line 1441

    I'm a little bit confused with these render functions, they are too many, and it looks like I can do same renders with all of them...
    for example, wich is the difference between renderWithLayout() and renderWithALayout()...

    If it's possible, I also like to know wich are the possible options to pass by array in the first parameter of the render functions...
    I don't see them anywhere...