| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
{section} How to end section loop early.... | |||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
{section} How to end section loop early....
Hi all,
I have a section that is looping through 1000's of records. When I find what I want, how do I exit the loop. ??? Any ideas ? As I cacnot seem to find anything on this. Example: Array is $test {section name=test loop=$test} {if $test[test] eq $my_parm} then I want to exit the loop ! How ? {/if} {/section} Any info would be great.
__________________
All versions of X-Cart Been in eCommerce 10 years, Coding, PM, SEO, Social. X-Cart 11 years. IT 30+ years. Head of Web Dev for Australia's largest eCommerce 2 years. Attended conferences, Velocity 2009 US, CeBit 2009, MySQL 2010 US, Online Retailer 2010, Web 2.0 2011 US, MySQL 2012 US (Percona). Specialise in High Performance, High Volume, PHP, MySQL, HTML, CSS, JAVASCRIPT, SMARTY, MEMCACHED, APACHE, LIGHTTPD, FREEBSD, LINUX. Email your requests to xcart@gazwebtech.com |
|||||||
#2
|
|||||||||
|
|||||||||
Array is $test
Code:
That code will only print the row in the loop that matches your $my_param. not sure if thats what your looking for. the loop would be made up from a php file / mysql statement and the {if} statement will pick out the row you want. If you wanted to minimise the amount of rows in the array you would need to alter the sql statement
__________________
Looking for a reliable X-cart host ? You wont go wrong with either of these. EWD Hosting Hands On Hosting |
|||||||||
#3
|
|||||||
|
|||||||
Issues with {section} processing time...
Hi,
Basically that is what I am doing. I just want to exit the loop once I have what I want as to minimize processing time. The way I have coded it. It works, but it is slow on large databases, just want to work out of a way of dropping out of the section once the if condition is met. Any ideas...
__________________
All versions of X-Cart Been in eCommerce 10 years, Coding, PM, SEO, Social. X-Cart 11 years. IT 30+ years. Head of Web Dev for Australia's largest eCommerce 2 years. Attended conferences, Velocity 2009 US, CeBit 2009, MySQL 2010 US, Online Retailer 2010, Web 2.0 2011 US, MySQL 2012 US (Percona). Specialise in High Performance, High Volume, PHP, MySQL, HTML, CSS, JAVASCRIPT, SMARTY, MEMCACHED, APACHE, LIGHTTPD, FREEBSD, LINUX. Email your requests to xcart@gazwebtech.com |
|||||||
#4
|
|||||||||
|
|||||||||
I would suggest filtering at the PHP level, either by the WHERE clause in you DB query (preferably), or by using foreach and if/then loops in PHP.
Processing time will be MUCH shorter. |
|||||||||
|
|||
X-Cart forums © 2001-2020
|