We fixed this by using the full path to the included Twig file… works great.
Hi, how can i set pageTitle in twig?
<?php
$this->pageTitle = Yii::app()->name . ' - Contact Us';
?>
I try like this but doesn’t work
{{ this.pageTitle = App.name ~ ' - Contact Us' }}
{{ this.pageTitle(App.name ~ ' - Contact Us') }}
thanks
Hi,
is there a command, which extracts translation messages from twig templates, like ./yiic message?
Best regards,
schmunk
Hi,
when in controller context this should work:
{% do this.setPageTitle('My title') %}
when in widget context:
{% do this.controller.setPageTitle('My title') %}
<?php
$this->breadcrumbs = array(
'Words',
);
How can i do this with Twig?
I also googled and got below code, but I got error when using it.<br />
Here is the code:
{% do this.setBreadCrumbs({
'Hoges': ['index'],
0: 'Manage',
}) %}
And the error is:
An exception has been thrown during the rendering of a template ("SiteController and its behaviors do not have a method or closure named "setBreadCrumbs".") in "\views\site\index.twig" at line 2.
Thanks
Здравствуйте.
Хотел бы узнать: рабочее ли еще это решение?
Делал все по инструкции в yiiframework.com/extension/twig-view-renderer/.
Там битая ссылка на сам инсталл twig`а, неправильные инструкции прописаны (поместить ETwigViewRenderer.php в protected/extensions, но в конфиге нужно прописать "ext.yiiext.renderers.twig.ETwigViewRenderer"). Еще My_Twig_Extension я так понял для примера, так-как оно не существует? Да и копипастнутая ошибка с "exten[color="#FF0000"]t[/color]ions" вместо "extension".
После исчезновения всех ошибок рендер не работает - содержимое шаблона выводится как есть со всеми тегами.
Если проект рабочий, попробуйте сделать все по инструкции - мне кажется это у вас не получится.
Update: попробовал сделать через инструкцию к composer`у.
Он закачал мне еще и сам фреймворк и плюс расширение yiiext к нему. Пути вроде правильные. Но ситуация та же - не рендерится ничего.