Standard site layout xml
Mark Knoop
mark at rawcane.net
Wed Mar 12 09:23:25 GMT 2008
> Just checking you have seen ttree?
>
> http://template-toolkit.org/docs/tools/ttree.html
>
> And plugins like:
>
> http://search.cpan.org/~abw/Template-XML-2.17/
>
> As well as some of the other plugins:
>
> http://search.cpan.org/search?query=Template%3A%3APlugin&mode=dist
>
Ah ok it figures that this is part of the TT framework. Not sure quite how
to get it to do what I need on first glance but will spend some time with
it.
Just to clarify (on rereading my original post it is a bit ambiguous) I am
currently doing something like the following:
<site>
<index file="index.tmpl">
<item id="Some_Item" position=1 />
<item id="Another_Item" position=2 />
<category="Some_Category" position=1 file="category.tmpl">
<item id="You_Get_The_Idea" position=1 />
<item id="Etc" position=2 />
<category="2nd_Tier" postion=1 file="category.tmpl">
...
</ category>
</ category>
<category="Another_Category" postion=2 file="category.tmpl">
...
</ category>
</index>
<other file="other.tmpl" />
<etc etc="etc.tmpl />
<site>
<content>
<item id="Some_Item" item_meta_data="..." />
<item id="Another_Item" item_meta_data="..." />
<item id="You_Get_The_Idea" item_meta_data="..." />
<item id="Etc" item_meta_data="..." />
</content>
and have a script that reads in the <site> data and uses template file which
have place holders for links to items and other categories - this enables me
to create large and complex site maps with the same few templates quite
easily (as long as the pages are all the same, although I can in theory use
different templates for each file as specified in the category element).
The pre TT template files look something like this:
...
<table>
<tr><td>GBUILD[IMG:Banner]</td></tr>
<tr><td>GBUILD[CATEGORY:NAME]</td></tr>
</table>
<table>
<tr><td>GBUILD[ITEM:THUMB_1]</td><td>GBUILD[ITEM:THUMB_2]</td></tr>
<tr><td>GBUILD[ITEM:LINK_1]</td><td>GBUILD[ITEM:LINK_2]</td></tr>
<tr><td>GBUILD[ITEM:THUMB_3]</td><td>GBUILD[ITEM:THUMB_4]</td></tr>
<tr><td>GBUILD[ITEM:LINK_3]</td><td>GBUILD[ITEM:LINK_4]</td></tr>
<tr><td>GBUILD[ITEM:THUMB_5]</td><td>GBUILD[ITEM:THUMB_6]</td></tr>
<tr><td>GBUILD[ITEM:LINK_5]</td><td>GBUILD[ITEM:LINK_6]</td></tr>
<tr><td>GBUILD[CATEGORY:LINK_PREVIOUS]</td><td>GBUILD[CATEGORY:LINK_NEXT]</td></tr>
</table>
<table>
<tr><td>GBUILD[AD:AD_001]</td></tr>
<tr><td>GBUILD[CATEGORY:LINK_%]</td></tr>
<tr><td>GBUILD[AD:AD_002]</td></tr>
<tr><td>GBUILD[LINK:Index]</td></tr>
<tr><td>GBUILD[LINK:Terms]</td></tr>
</table>
...
so the build.pl script can match up links and thumbs to items, create
multiple pages with forward and back links when there are more then (in this
case) 6 items in a category. It means I can quickly and easily move content
items and categories around and rebuild the site.
As always would be interested in other approaches...
Cheers
Mark
More information about the london.pm
mailing list