php - Add new context variables to lithium\template\view\adapter\File -


i'd replicate functionality of $this->head() , $this->scripts() handlers add $this->footer(). understand can use renderer::handlers() register new handler, i'm not sure how can extend file::$_context property add new footer context.

so far, assume i'd add snippet below html helper.

protected function _init() {     parent::_init();      if ($this->_context) {         $ctx =& $this->_context;          $this->_context->handlers(array(             'footer' => function($footers) use (&$ctx) {                     return "\n\t" . join("\n\t", $ctx['footer']) . "\n";                 }         ));     } } 

perhaps i'm overthinking it, , should extend html helper replicate functionality.

i haven't tested this, way __call() works, should able $this->_context += ['footer' => []] inside _init() call $this->footer("foo!") append.

when you're ready render, $this->context("footer") should give array of values.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -