How to keep multiple templates in sync - use includes?
Posted: Tue Feb 14, 2012 8:50 am
When developing a site I try to stick to a single template as much as possible, and use smarty logic to add elements that I only want on certain pages or sections. Eg.
{if $page_alias eq "news"}
.....
{/if}
This is because most of my template elements appears on all pages, and if I update the design I don't want to have to update multiple templates to keep them in sync.
So that's fine, but the problem is when I want to use AdvancedContent blocks on some pages but not all pages - even if the AdvancedContent blocks are defined within smarty {if} tags, the AdvancedContent fields are added to every page when editing in Admin, where they are irrelevant to most pages.
It looks like multiple templates might be unavoidable here. So can anyone advise how they manage multiple templates and keep them in sync? Breaking the template up into smaller sub-templates that are then pulled together using includes seems sensible. Global Content Blocks would be one easy way, but I want to give my users permission to edit GCBs and I worry about critical template elements getting messed with. So is there another type of include or method I could use?
{if $page_alias eq "news"}
.....
{/if}
This is because most of my template elements appears on all pages, and if I update the design I don't want to have to update multiple templates to keep them in sync.
So that's fine, but the problem is when I want to use AdvancedContent blocks on some pages but not all pages - even if the AdvancedContent blocks are defined within smarty {if} tags, the AdvancedContent fields are added to every page when editing in Admin, where they are irrelevant to most pages.
It looks like multiple templates might be unavoidable here. So can anyone advise how they manage multiple templates and keep them in sync? Breaking the template up into smaller sub-templates that are then pulled together using includes seems sensible. Global Content Blocks would be one easy way, but I want to give my users permission to edit GCBs and I worry about critical template elements getting messed with. So is there another type of include or method I could use?