Mgccl Posted February 26, 2007 Share Posted February 26, 2007 {while expression}{/while} I’m trying to create a ultra fast and yes, insecure template system. And I like to have a while loop system, and here is the syntax for a while loop {while expression}template content{/while} I could write a regex to replace it so it looks like this {while expression}template content{/while} becomes <?php while(expression){ ?> template content <?php } ?> But now I really want to implement a system that counts the iteration of the while loop. So it should become something like this: <?php $iteration = 0; while(expression){ ?> template content <?php ++$iteration; } ?> But, if there is a while loop within a while loop, like this {while expression}{while expression2}{/while}{/while} Then this causes the code to be something like this <?php $iteration = 0; while(expression){ ?> <?php $iteration = 0; while(expression2){ ?> <?php ++$literation; } ?> <?php ++$iteration; } ?> And this will cause the iteration count to be wrong, does anyone have a suggestion to solve this problem? Link to comment https://forums.phpfreaks.com/topic/40207-a-tempalte-system-problem/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.