good morning, I have a problem with the widgets and smarty …
I am not able to display the widget where I want to show it.
smarty is my version:Smarty 3.1.7 Released
my yii framework is:v1.1.9
and smarty-renderer :v1.0.2
I have a tpl file where I have the call to the widget:
principal.tpl
<div class="container" id="page">
<div id="header">
<div id="logo">{$PageName}</div>
</div><!-- header -->
<div id="mainmenu">
<ul id="yw0">
{foreach $Menu as $pack}
<li><a href="{$pack.url}">{$pack.label}</a></li>
{/foreach}
</ul>
</div><!-- mainmenu -->
{widget('zii.widgets.CBreadcrumbs',['links'=>$this->breadcrumbs],true)}
{$Contenedor}
<div class="clear"></div>
and php file:
main.php
$smarty = new Smarty();
$smarty->assign("URL",Yii::app()->request->baseUrl);
$smarty->assign("PageTitle",CHtml::encode($this->pageTitle));
$smarty->assign("PageName",CHtml::encode(Yii::app()->name));
$smarty->display("templates/principal.tpl");
the error I get is:
PHP notice
Undefined index: this
/var/www/Codesk2/templates_c/9498380aff9ec2291ebe746945e4167a401df325.file.principal.tpl.php(85)
73 <?php $_smarty_tpl->tpl_vars['pack'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['pack']->_loop = false;
74 $_from = $_smarty_tpl->tpl_vars['Menu']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
75 foreach ($_from as $_smarty_tpl->tpl_vars['pack']->key => $_smarty_tpl->tpl_vars['pack']->value){
76 $_smarty_tpl->tpl_vars['pack']->_loop = true;
77 ?>
78 <li><a href="<?php echo $_smarty_tpl->tpl_vars['pack']->value['url'];?>
79 "><?php echo $_smarty_tpl->tpl_vars['pack']->value['label'];?>
80 </a></li>
81 <?php } ?>
82 </ul>
83 </div><!-- mainmenu -->
84
85 <?php echo $_smarty_tpl->tpl_vars['this']->value->widget('zii.widgets.CBreadcrumbs',array('links'=>$_smarty_tpl->tpl_vars['this']->value->breadcrumbs),true);?>
86
87
88
89
90 <?php $_smarty_tpl->tpl_vars['pack'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['pack']->_loop = false;
91 $_from = $_smarty_tpl->tpl_vars['migas']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
92 foreach ($_from as $_smarty_tpl->tpl_vars['pack']->key => $_smarty_tpl->tpl_vars['pack']->value){
93 $_smarty_tpl->tpl_vars['pack']->_loop = true;
94 ?>
95 <?php $_smarty_tpl->tpl_vars['rest'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['rest']->_loop = false;
96 $_from = $_smarty_tpl->tpl_vars['pack']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
97 foreach ($_from as $_smarty_tpl->tpl_vars['rest']->key => $_smarty_tpl->tpl_vars['rest']->value){
this is what I have and I can not use this widget,I am lost with the use of widgets and I do not get advance.
can help me ?
thank you very much!