[Templates] template introspection?

John Napiorkowski jjn1056@yahoo.com
Mon, 5 Mar 2007 15:44:58 -0800 (PST)


Hi,=0A=0AFrom the documentation I can see there is quite a few introspectio=
n abilities via the template and component variables.  However I'm trying t=
o do something a little more complex and can't figure out if there is a str=
aightforward way to do this within TT or if I'm going to need to post proce=
ss my output with XSLT or similar.  Here's what I'm trying to do:=0A=0AIn m=
y CMS I have defined a number of wrapper templates to allow my users to sim=
plify and standardize our eventual output.  One example of this is that I h=
ave a 'row' wrapper that defines some div tags and css to enclose some cont=
ent.  Inside each row the user can define one or more 'cell' wrappers to ad=
d in html and css tags to properly align out content.  For (simplified) exa=
mple:=0A=0A[% WRAPPER row %]=0A    [% WRAPPER cell=0A         type =3D 'lef=
t' %]Some content[% END %]=0A    [% WRAPPER cell=0A=0A         type =3D 'le=
ft' %]Some content[% END %]=0A=0A    [% WRAPPER cell=0A=0A         type =3D=
 'right' %]Some content[% END %]=0A[% END %]=0A=0AEventually we end up gene=
rating pages with complex layout like the following: http://216.154.222.179=
:10000/previewer/communities=0A=0AOne of the things I am trying to do is ma=
ke my processing smarter and allowing my templates to be better at guessing=
 what values should be.  This would allow my users to reduce the amount of =
stuff they put into the template, which should reduce errors and make our t=
emplates cleaner and more consistent.  For example if the above code the 'c=
ell' template wrapper takes a value called 'type'.  I need this information=
 to pass to the part of the code that builds the CSS for each cell.  Basica=
lly I find that I need the last cell to have special CSS in order to work p=
roperly.  I'd like somehow to detect if the currently processing template i=
s the first or last in a given 'parent' but I can't figure this out.=0A=0AI=
 can see some ways to do this but they all involve creating more complex ma=
rkup then I already have.=0A=0AI realize this sounds like a trivial example=
, but I have more complex use cases of the above.  In general I have severa=
l cases where knowing if the currently processing template is the first or =
the last template for a given caller.  If hearing about that would help und=
erstand my question I will be happy to provide.=0A=0AThanks for any thought=
s or suggestions.=0A=0A--John=0A=0A=0A=0A=0A=0A=0A=0A =0A__________________=
__________________________________________________________________=0ANeed M=
ail bonding?=0AGo to the Yahoo! Mail Q&A for great tips from Yahoo! Answers=
 users.=0Ahttp://answers.yahoo.com/dir/?link=3Dlist&sid=3D396546091