 |
Smarty
The discussions here are for Smarty, a template engine for the PHP programming language. Dedicated server web hosting provided by Guru-host.eu. |
| View previous topic :: View next topic |
| Author |
Message |
firepages Smarty Rookie
Joined: 03 May 2012 Posts: 6
|
Posted: Tue May 08, 2012 5:15 am Post subject: cycle not working in foreach |
|
|
is it supposed to or not ? I only see examples in section's but assumed it would work in a foreach as well...
| Code: |
{foreach $USERS as $u}
<tr class="{cycle values='rowa,rowb'}">
<td>{$u.co_id}</td>
<td>{$u.co_name}</td>
<td>{$u.co_surname}</td>
<td>{$u.co_user}</td>
<td>{$u.co_suburb}</td><td>{$u.co_state}</td>
<td>{$u.co_join_pretty}</td>
<td><a href="?FPA_TASK=fpa_contacts_admin&_ctl_edit={$u.co_id}">view/edit</a></td>
</tr>
{/foreach}
|
I am getting
unknown tag "cycle"' in /home/httpd/vhosts
I am assuming I don't have to assign cycle ? |
|
| Back to top |
|
firepages Smarty Rookie
Joined: 03 May 2012 Posts: 6
|
Posted: Tue May 08, 2012 5:35 am Post subject: solved but... |
|
|
ok found ..
<tr class="{if $u@iteration is even}rowa{else}rowb{/if}">
but would still like to know if cycle is deprecated or perhaps was never supported with foreach, if its in the docs i really cant find it |
|
| Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 4199 Location: Hamburg / Germany
|
Posted: Tue May 08, 2012 8:26 pm Post subject: |
|
|
{cycle} is a plugin located in the plugins folder of the distribution. It looks like that $plugins_dir was not set up correctly.
You could run $smarty->testInstall(); to check your configuration. |
|
| Back to top |
|
firepages Smarty Rookie
Joined: 03 May 2012 Posts: 6
|
Posted: Tue May 08, 2012 11:07 pm Post subject: solved, thankyou |
|
|
thankyou! , I had added my own plugin dir
$smarty->plugins_dir = FP_FILE_ROOT.'/data/res/smarty';
now changed to
$smarty->plugins_dir = array(FP_FILE_ROOT.'/data/res/smarty',FP_LIB.'/smarty/libs/plugins');
and all working as expected, cheers! |
|
| Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|