How could I use Phalcon\Tag with an external template engine such as Smarty in phalcon 0.5
Question
I followed this docs and created an adapter for Smarty. And I want to use Smarty as the default template engine in my project. In this case, can I use Phalcon\Tag or $this->partial() inside the .tpl file? And how?
Solution
In your controller you can do something like this:
$register_link = \Phalcon\Tag::linkTo('register', 'Register');
$index_link = \Phalcon\Tag::linkTo('index', 'Index');
$this->view->setVar('my_register_link', $register_link);
$this->view->setVar('my_index_link', $index_link);
In the view you can do this:
<div id='links'>
{if $somevariable}
{$my_register_link}
{/if}
{$my_index_link}
</div>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow