Template display logic

A general technical discussion area for patTemplate.
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 200
Joined: Wed Aug 24, 2005 7:20 pm
Location: Los Angeles

Template display logic

Post by dynedain » Fri Jul 28, 2006 9:44 pm

This is a good example of why something with a bit more display logic than patTemplate is needed, and a problem I'm currently running into.

Suppose I'm developing a template in such a way so that the admin can pick which patTemplate is used to display the component in the front end. Seperating the display from the component logic, so that the admin can create new templates specific to his/her site design and needs.

Lets say the result that the component is generating is 20 thumbnailed images. AdminA wants to display the info in an un-ordered list. AdminB wants to display them side by side and let page wrapping take care of vertical positioning. AdminC wants to display them in a 4x5 table.

How can this be accomplished with patTemplate? Ideally, each admin should be able to create their own template file for their display needs, and then simply tell the component to use their template (through params, a config file, or any other way it could work). But, as far as I have been able to determine, that's simply not possible. The component developer has to define the display logic possibilities in the component, anticipating that some users may want tables with varying number of columns, some tables with varying rows, some lists (ordered and unordered), some no filtering, and countless other display methods and combinations. Working with patTemplate means that the developer has to predict the display formatting and provide for it. see this example on the recommended way of dealing with data in a table display. If the developer wants the admin to be able to display the data in a different method, the developer has to provide the admin with an alternative display method that the admin can pick alongside picking their template.

I guess what I'm getting at, is that if the logic portion of the component has to pre-format the content in anticipation of what the template will do, what's the point of the extra overhead in using the templating system?

If I'm wrong about this, and there is a way to let the output flow behave differently with different templates, I'd love to hear it.


Return to “patTemplate”