Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.
Dedicated server web hosting provided by Guru-host.eu.
cycle not working in foreach

 
Post new topic   Reply to topic    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
firepages
Smarty Rookie


Joined: 03 May 2012
Posts: 6

PostPosted: Tue May 08, 2012 5:15 am    Post subject: cycle not working in foreach Reply with quote

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
View user's profile Send private message
firepages
Smarty Rookie


Joined: 03 May 2012
Posts: 6

PostPosted: Tue May 08, 2012 5:35 am    Post subject: solved but... Reply with quote

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
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 4199
Location: Hamburg / Germany

PostPosted: Tue May 08, 2012 8:26 pm    Post subject: Reply with quote

{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
View user's profile Send private message
firepages
Smarty Rookie


Joined: 03 May 2012
Posts: 6

PostPosted: Tue May 08, 2012 11:07 pm    Post subject: solved, thankyou Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP