Note that there are some explanatory texts on larger screens.

plurals
  1. POCodeIgniter Template variables not working all the time
    text
    copied!<p>I'm trying to allow each of my pages to have a dynamic title field.</p> <p>I'm using <a href="http://williamsconcepts.com/ci/codeigniter/libraries/template" rel="nofollow">this template system</a> library with CodeIgniter 2.</p> <p>Below is a sample of my opening tags, showing that I'm using a variable called <code>$title</code> to store the current page's title.</p> <pre><code>&lt;html xml:lang="en" lang="en" xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /&gt; &lt;title&gt;CnCFPS &lt;?php echo "| $title"; ?&gt;&lt;/title&gt; &lt;meta http-equiv="Content-Language" content="en" /&gt; &lt;meta name="Description" content="Todo" /&gt; &lt;meta name="Keywords" content="Todo" /&gt; </code></pre> <p>I'm writing it out to the view using <code>$this-&gt;template-&gt;write_view( 'content', 'path/to/view', $data' );</code> in which <code>$data</code> is an array:</p> <pre><code>$data['recaptcha'] = $this-&gt;recaptcha-&gt;get_html(); $data['title'] = "Account Registration"; </code></pre> <p><code>$title</code> seems to not exist on the template as a variable because all I get is "CnCFPS | " between the <code>&lt;title&gt;</code> tags. The <code>$recaptcha</code> variable works perfectly fine though. </p> <p>I've attempted the example on <a href="http://williamsconcepts.com/ci/codeigniter/libraries/template" rel="nofollow">the link above</a> using <code>$this-&gt;template-&gt;write( 'title', 'Insert Title Here');</code> and even defined a title in my $template array from <code>configs\template.php</code>.</p> <p><strong>I don't know what's up with this and why it won't display the page title.</strong></p> <p>Any help is appreciated, thanks!</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