Akelos Framework v1 forum archive. This forum is no longer maintained. To report bugs please visit https://github.com/akelos/akelos/issues
    • CommentAuthorpweil
     
    How can one turn on output buffering for data rendered in a template? I have three functions I want to run in order to wrap certain terms in abbreviation tags:

    1) ob_start("bufferModify")

    2) bufferModify()

    3) addAbbrevs()

    4) ob_end_flush() (may not be needed since PHP does this automatically at the end of a script)

    I've tried placing these in the layout helper, but it doesn't seem to work. Akelos tells me I can't run ob_start() from within a template. Any suggestions?
    •  
      CommentAuthorbermi
     

    Akelos will try to send the right headers after rendering all the templates, this makes not possible to emit the buffer before sending Response headers.

    I'm not sure what is your use case, but you might have a look at the capture_helper

    …in your view

    <? $capture_helper->begin ('script'); ?>
    alert('hello world');
    <? $capture_helper->end (); ?>
    

    and in your layout

    <script type="text/javascript">
    {content_for_script}
    </script>