![]() |
{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. |
Array is $test
Code:
{section name=test_num loop=$test} 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 |
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... |
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. |
All times are GMT -8. The time now is 07:33 PM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.