X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Smarty {break} and {continue} Tags (https://forum.x-cart.com/showthread.php?t=68154)

PhilJ 11-14-2013 06:47 AM

Smarty {break} and {continue} Tags
 
2 Attachment(s)
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 :)

qualiteam 11-17-2013 11:47 PM

Re: Smarty {break} and {continue} Tags
 
Phil, thanks for sharing this!

I've moved all other messages on switching XC4 to Smarty 3 into a separate thread:
http://forum.x-cart.com/showthread.php?p=366487

Ben G 09-08-2014 06:13 PM

Re: Smarty {break} and {continue} Tags
 
Thanks Phil!

New functionality worked a treat in this mod for wholesale prices in v4.6.4
http://forum.x-cart.com/showthread.php?p=377050#post377050

I bet there'll be some long scripts in the rest of the standard code that the {break} tag can be used in larger stores to help improve site speed.


All times are GMT -8. The time now is 03:51 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.