<ralphdahlgren.com>
<ralphdahlgren.com>
Just when you thought it would never happen again - another template tutorial. But before you make a hasteful judgement about my sanity, there really is good reason for yet another template tutorial. Read on.
With all of my experimenting with different methods of implementing Chunks for templating, the one feature that I have always felt was missing has been a looping feature. Well, I finally got around to modifying the parseChunk() API function to allow single level looping. It is now possible to send a two dimensional array of data in the $chunkArr parameter of the parseChunk() call. All that was required was a check to see if a passed parameter is an array. If the parameter is an array it is then processed by looping though the array and replacing place-holder tags, located between a loop tag pair similar to {rows}...{/rows}. While this simple implementation doesn't allow nested looping I don't see this as being a major issue.
The example below is almost identical to the one in the previous tutorial. The only difference is that this one requires no embedded PHP code to achieve virtually the same results. The one difference that should be noted is that I ran into problems when attempting to use PHP remark tags - perhaps because the slashes cause problems with the slash in the closing loop tag. I haven't taken the time to experiment but I'm sure there is a solution and HTML remark tags should work perfectly. Remember, in this tutorial it's all about the Chunk.
| Title | Author | Created | Edited | Longtitle |
|---|---|---|---|---|
| Home | Ralph Dahlgren | 2004-06-13 | 2008-10-23 | ralphdahlgren.com |
| Etomite CMS News | Ralph Dahlgren | 2004-07-28 | 2007-09-17 | Etomite code base development news |
| Site Map | Ralph Dahlgren | 2006-04-07 | 2007-09-10 | Links to every page on this web site |
| Code Library | Ralph Dahlgren | 2007-09-07 | 2007-09-17 | View examples of resources used to render this site |
| Search Help | Ralph Dahlgren | 2007-09-12 | 2007-12-06 | A brief explanation about effective search practices. |
| Tutorials | Ralph Dahlgren | 2007-09-12 | 2007-09-17 | Learn the hidden powers of the Etomite API |
| Ralphs Rants | Ralph Dahlgren | 2007-09-12 | 2007-12-19 | Where's my soap box? |
| Login|Logout | Ralph Dahlgren | 2007-09-20 | 2008-11-09 | Provides a visitor authentication login interface |
Sample Tag Text
{unused_tag}Etomite "IS" a template engine, dummy!