[LRUG] A question about template nesting preferences :)

Ed Jones ed at error.agency
Sun Sep 27 10:07:42 PDT 2020


If you consider encapsulation of the functionality, the second choice makes a lot more sense to me.

It also means that refactoring your markup in the future only requires changing the order of your templates, not messing with the thing which calls them. 

(which is sort of two ways to say the same thing 🙂)

Ed

> On 27 Sep 2020, at 13:14, Denny <2020 at denny.me> wrote:
> 
> Hi all,
> 
> I'm working on a CMS with a theme system that allows you to selectively override just the bits you don't like from the default templates - so you can knock together minor variations quite quickly.
> 
> If you were working with this system, would you prefer the default templates to look like this...
> 
> Top level template:
> <... header stuff ...>
> <section>
>  <include SectionTemplate>
> </section>
> <... footer stuff ...>
> 
> SectionTemplate:
> <... stuff that goes inside the section ...>
> 
> Or like this...
> 
> Top level template:
> <... header stuff ...>
> <include SectionTemplate>
> <... footer stuff ...>
> 
> SectionTemplate:
> <section>
>  <... stuff that goes inside the section ...>
> </section>
> 
> In the above example, you might be choosing to override the general layout (the top level template) but still using the original template for the section content, or you might be leaving the layout alone and just overriding the section content template. I think my answer flip-flops depending on which of those scenarios I think about, so I was interested in hearing other people's thoughts...
> 
> Cheers,
> Denny
> _______________________________________________
> Chat mailing list
> Chat at lists.lrug.org
> Archives: http://lists.lrug.org/pipermail/chat-lrug.org
> Manage your subscription: http://lists.lrug.org/options.cgi/chat-lrug.org
> List info: http://lists.lrug.org/listinfo.cgi/chat-lrug.org


More information about the Chat mailing list