View Single Post
  #1  
Old 11-14-2013, 06:47 AM
 
PhilJ PhilJ is offline
 

X-Guru
  
Join Date: Nov 2002
Posts: 4,094
 

Default Smarty {break} and {continue} Tags

Thought I'd share this...

Smarty {break} & {continue} tags are not available in Smarty v2, but are in Smarty v3.

They are handy, for example, if you want to truncate {foreach} or {section} items after x items / iterations.

Code:
{foreach from=$foo item=x name=whatever} {if $smarty.foreach.whatever.index == 3} {break} {/if} ... {/foreach}

(stops on third item)

Upload the attached two PHP files to /include/templater/plugins and you can use {break} and {continue}

Might assist some of you out there
Attached Files
File Type: php compiler.break.php (82 Bytes, 235 views)
File Type: php compiler.continue.php (88 Bytes, 221 views)
__________________
xcartmods.co.uk
Reply With Quote