CodeIgniter Forums
template library sending vars to view - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: template library sending vars to view (/showthread.php?tid=16962)



template library sending vars to view - El Forum - 03-21-2009

[eluser]neosable[/eluser]
I have this:

Code:
$data['hello'] = 'hello';
$this->template->write_view('content', 'user/register', $data);
$this->template->render();

and in the view:

Code:
<h2> New user sign up &lt;? echo $hello ?&gt;</h2>

but there is no displaying hello in the view, what can be the problem ?


template library sending vars to view - El Forum - 03-21-2009

[eluser]TheFuzzy0ne[/eluser]
Try
Code:
&lt;?php echo $hello; ?&gt;

instead. It may be that short tags are not supported by your server.


template library sending vars to view - El Forum - 03-22-2009

[eluser]neosable[/eluser]
lol that was so simple that never thought about it

thanks


template library sending vars to view - El Forum - 03-22-2009

[eluser]TheFuzzy0ne[/eluser]
For servers that run PHP 4, CodeIgniter can parse short tags for you at the expense of a little extra overhead. If you want this functionality, change:
Code:
$config['rewrite_short_tags'] = FALSE;

# To...

$config['rewrite_short_tags'] = TRUE;
at the bottom of your config.php.