CodeIgniter Forums
Phil Sturgeon templating library and Dwoo parser both working, but not together - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: Phil Sturgeon templating library and Dwoo parser both working, but not together (/showthread.php?tid=47707)



Phil Sturgeon templating library and Dwoo parser both working, but not together - El Forum - 12-19-2011

[eluser]Unknown[/eluser]
Hello happy helpers,

I have Phil Sturgeon's templating extension working - I've tested it. And independently I have the Dwoo parser working, which was recommended in Phil Sturgeon's documentation. But I am not sure how to make the two work together. The following works for me:

Code:
$this->template->title('Page Title', 'Page Title 2');
$this->template->set('foo', 'bar');
$this->template->build('welcome_message');
Code:
<p>&lt;?php echo $foo;?&gt;</p>
<p>&lt;?php echo $template['title'];?&gt;</p>

And this works:
Code:
$this->parser->parse('welcome_message');
Code:
<p>{$foo}</p>

But if I leave my view full of {$foo} and don't call $this->parser but just use $this->template->build then it doesn't parse the braces, it just echoes it as a string.

It is as if the parser isn't being called by the templating class - but the following $config['parser_enabled'] = TRUE; is set in the config.

Where am I going wrong? Why isn't the parser being called by the template class? Thank you in advance.