Note that there are some explanatory texts on larger screens.

plurals
  1. POIncluding a php file with includes into a smarty template
    primarykey
    data
    text
    <p>I want to include my header into a script that uses <strong>smarty templates</strong>. From searching this site, I am partially there, but not quite:</p> <pre><code>{include file='/home/username/public_html/header.php'} </code></pre> <p>This successfully includes the image in the header, but neither of two includes the header contains. One of the includes is a php file, and the other is html (my bootstrap nav bar). I seems from my searches that I need to make a plugin, which according to one post is "easy", but I can't find an example of how to accomplish this?</p> <hr> <p>based on codefreaks inststructions, here's what I did. I'm sure the instructions are correct, I'm just not interpreting them correctly, as this isn't displaying anything.</p> <p>Here are the three files, with their paths in relation to the public_html directory, and what I added to them. Everything is exactly as I put it: no words here are placeholders. </p> <p><strong>file 1</strong> <code>sitewide/myheader.php</code></p> <pre><code>&lt;? ob_start(); --- I didn't change the original content here -- $output = ob_get_contents(); ob_end_clean(); ?&gt; </code></pre> <p><strong>File 2</strong> <code>newscript/includes/page_header.php</code></p> <pre><code>$smarty = new Smarty(); require "/home/username/public_html/sitewide/myheader.php"; $smarty-&gt;assign('myheader', $output); $smarty-&gt;display('../themes/default/template/header.tpl'); </code></pre> <p><strong>File 3</strong> <code>newscript/themes/default/template/header.tpl</code></p> <pre><code>{$myheader} </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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