<ralphdahlgren.com>


 
Navigation
  • Home
  • Etomite CMS News
  • Code Library
  • Tutorials
    • Templates
    • New parseChunk() Tutorial
    • XHTML Objects
    • XMLHttpRequest
    • Complex Active Chunks
  • Ralphs Rants
  • Site Map
  • Login|Logout
 
Credits
 
Valid XHTML 1.1 Valid CSS! Powered By PHP Powered By MySQL
Powered By Etomite
 
 
Other Etomite Sites
dahlgren.slyip.com
n-vent.com
 

New parseChunk() Tutorial

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.

Sample Top Caption
Title Author Created Edited Longtitle
Home Ralph Dahlgren 2004-06-13 2010-05-19 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 2008-12-25 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
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
Xinha Testing Ralph Dahlgren 2009-09-02 2010-08-10 Xinha 0.96 Pheonix Integration Testing

Sample Tag Text

{unused_tag}

Etomite "IS" a template engine, dummy!


  Error -- Usage: [ [DisplayCode?type=chunk|file|snippet|template&name=Name] ]
  Error -- Usage: [ [DisplayCode?type=chunk|file|snippet|template&name=Name] ]

Powered by Etomite 1.1 (Prelude).
MySQL: 0.0232 s, 14 request(s), PHP: 0.0212 s, Total: 0.0444 s, document retrieved from database
2010-09-07 11:31 PM