Template inheritance?
Posted: Sat Nov 24, 2007 6:46 pm
Hello dev-people
My designer had an interesting suggestion, which I thought I'd run through you. When we built up site we often are in the situation where we have an overall design of the page and then the content-area can have several looks, 3 columns, 2 columns and some static/news etc. Doing 3-4 complete templates works but it's not nice when we then have to tweek design later, having to make the same changes 3-4 places. What we talked about was some way of having a template inheriting from another so that it replaces the {content} tag of the "mother"-template, and in turn replaces it's own {content} tag with the actual content. As far as I can see there's 2 was of doing this, the easy and the hard...
1. Having a field in template editing providing a list of the other templates defining simply a template to include when the present one it selected. This brings up some questions as to multiple levels and the resulting possibility of recursion. Not nice. Could be overcome by limiting to 1 level of inheritance
2. Doing an actual hierarchy (I love spellchecking in FireFox) of templates, like in pages, allowing subtemplates to include mother-templates without the fear of recursion.
What do you think? I don't think it's that difficult to do, it won't make the process more complex as you can easily ignore the "mothertemplate" option... But it will make templating very powerful.
Some thought should go into the matter of stylesheet-inclusiong I guess, but that should be solvable
Regards
Silmarillion/Morten
My designer had an interesting suggestion, which I thought I'd run through you. When we built up site we often are in the situation where we have an overall design of the page and then the content-area can have several looks, 3 columns, 2 columns and some static/news etc. Doing 3-4 complete templates works but it's not nice when we then have to tweek design later, having to make the same changes 3-4 places. What we talked about was some way of having a template inheriting from another so that it replaces the {content} tag of the "mother"-template, and in turn replaces it's own {content} tag with the actual content. As far as I can see there's 2 was of doing this, the easy and the hard...
1. Having a field in template editing providing a list of the other templates defining simply a template to include when the present one it selected. This brings up some questions as to multiple levels and the resulting possibility of recursion. Not nice. Could be overcome by limiting to 1 level of inheritance
2. Doing an actual hierarchy (I love spellchecking in FireFox) of templates, like in pages, allowing subtemplates to include mother-templates without the fear of recursion.
What do you think? I don't think it's that difficult to do, it won't make the process more complex as you can easily ignore the "mothertemplate" option... But it will make templating very powerful.
Some thought should go into the matter of stylesheet-inclusiong I guess, but that should be solvable
Regards
Silmarillion/Morten