I am trying to use SmartyViewRendere in Yii. I got everything setup according to the instructions for using Smarty with Yii.
In my application I want to render a template called widgets_sidebar_template.tpl
<h1>Widgets bewerken voor Sidebar #<?php echo $model->id; ?></h1>
<?php $this->render('widgets_sidebar_template', array(
'available_widgets'=>$available_widgets
)
) ?>
This works fine.
Then the widgets_sidebar_template.tpl file:
$smarty->assign('availables', $available_widgets);
?>
<article id="widgets_container">
<ul id="available_widgets" class="connect">
<span>Beschikbaar</span><br><br>
{foreach from=$availables key=k item=available}
<li>{$available}</li>
{/foreach}
</ul>
<ul id="active_widgets" class="connect">
<span>Actief</span><br><br>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</article>
This file gives the error
Undefined index: availables
So the first thing that came up to me is that I needed to make sure $available_widgets is an array. So I figured that out and I am 100% sure it's an array with data. Then I checked if the $available_widgets is actually assigned to 'availables' ($availables), so i removed the:
$smarty->assign..
This gave me the same error as it was, so my guess is that i'm doing something wrong with the assigning of the 'availables' smarty array.
I hope one of you guys can give me some more advice based on this intel. Thanks:)