Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<pre><code> parent::before(); // Initialize default template variables $this-&gt;template-&gt;styles = Kohana::config('site.styles'); $this-&gt;template-&gt;scripts = Kohana::config('site.scripts'); $this-&gt;template-&gt;title = ''; $this-&gt;template-&gt;content = ''; /* make your view template available to all your other views so easily you could access template variable */ View::bind_global('template', $this-&gt;template); </code></pre> <p>in a certain view use something like this</p> <pre><code> $template-&gt;scripts[] = 'js/example.js'; </code></pre> <p>and in main view (template view) at the end you will have a colected array of js from different views</p> <pre><code> &lt;?php foreach($template-&gt;scripts as $file) { echo Html::script($file), "\n"; } ?&gt; </code></pre> <p>using this approach you must call <strong>render method</strong> on every view utilized (do this on top of template view script) and then insert variables with rendered content like bellow</p> <pre><code>$top = View::factory('elements/top_nav')-&gt;render(); $content = $content-&gt;render(); $footer = View::factory('elements/footer')-&gt;render(); &lt;div id="content"&gt; &lt;?php echo $content;?&gt; &lt;/div&gt; &lt;div id="meniu"&gt;&lt;?php echo $top;?&gt;&lt;/div&gt; you could add inline scripts as well, just add a $template-&gt;inline_scripts populate it with $template-&gt;inline_scripts = array('&lt;script type="text/javascript"&gt;Cufon.replace(\'#meniu ul.topnav li a\');&lt;/script&gt;'); and show it on template view script with a foreach($template-&gt;inline_scripts as $inline_script) { echo $inline_script."\n";}; </code></pre> <p>`</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload