Hey!
So here at work we have a home grown templating system, that is light weight and works great for us so far.
The wall we're hitting is that we want to be able to loop over a template. The use case is something like search results. We are trying to think of ways that we could do this. We've come up with three ways right now. First is the good old storing the html inside the loop and then looping over it and using concat to put the variables into the html. The second way we thought up was including a file repeatedly. And the third way was to include the file once, use output buffereing to capture its output, add the text echo " to it, and then using eval on it. (My boss wanted us to come up with creative ways of doing it).
Well, I prefer the include repeatedly method, as it allows us to separate the html from the logic completely. The eval method also does this, but it seems a little more hackish. Well we did some time tests on this and found that having the html right inside the loop (method one) was the quickest, and that was followed by the eval method, and including multiple times came in last. Including was actually about 5-6 times slower than the eval method. (We included the file/evaluated the file 1000 times, and did that 100 times and averaged them to get our results).
Is there any way to speed up the multiple include? (It would appear that each time we do the include php is hitting the file system again.)
Or does anyone have a way of accomplishing this type of thing?