On Mon, 2005-11-14 at 23:42, Leonard Burton wrote: > HI All, > > In your template parsing classes do you put the code for tags in > seperate files or do you have some kind of array or other method of > assigning the action associated with the tag? > > I have been putting the code for the tags in a dat/tag.dat file and > then including the file wherever the tag is called. For good measure > I call the attributes in the tags (which a returned by a regex) as > $ATTRIBUTES['name']. and then any data needing passed back from the > code in the tag I call $PASSBACK['name']. > > Does this seem standard? I have looked through a few template parsing > classes and feel it is easier to come up with my own than it is to use > most of them. I don't think there's a standard per se :) Different template systems reach for different results and employ different methods in doing so. At some point though there needs to be something to handle the content/attributes and so your inclusion system works. My own system requires that custom compilers be configured (registered) in the project config file, and then the template manager loops over each entry and allows each one to process the content in turn. Most of these custom compilers inherit from a base compiler class and so the actual parsing code is shared, upon parsing, the code performs a call to tag handling methods contained/registered in the compiler object that can process the content that was parsed. In this way custom compilers of different semantics can be plugged in with a simple registry entry. Additionally within this system the generated content can itself include custom tags/content which can subsequently be reparsed. This can cause recursion issues if the developer isn't wary, but allows for the building of custom tags based on smaller custom tags. HTH, Rob. -- .------------------------------------------------------------. | InterJinn Application Framework - http://www.interjinn.com | :------------------------------------------------------------: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `------------------------------------------------------------' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php