Forum

Thread tagged as: Discussion

Best way to use master pages for slight variants in pages?

After years of using Perch, I've only just begun to use 'master pages' and 'layouts' for sites. This came about after using Runway for the first time. Before then I used PHP includes a lot, for parts of pages similar across an entire site.

So, now I'm using master pages (and its so much better) I have a question about the best way to do something, while still using master pages.

Assume that almost all of the website uses a specific page design and regions. Naturally, I create a master page for this. Any design change needed is then done in the master page and the entire website then picks up that change.

However now assume that a few of the pages in the site are VERY similar to the main ones, but differ only slightly because perhaps they need a second column, or a slight variation in the header or footer, or I want to insert <?php perch_pages_navigation(); ?> into just one of the pages to show the site map.

Do I create another master page for each of these slight variants?

Or is there a recommended way to use the same/main master template but code those variations into it somehow?

Thanks, Graham

Graham Street

Graham Street 17 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

I guess it depends on how/when/why you want to choose which of those to use.

One option is to use page attributes to switch parts of a page on and off.

Another option is to have multiple master pages, but to construct them mainly using layouts, so that you have minimal duplication.

As ever, it depends!

Great. Both solutions would work for me. I already use a page attribute (a page numbering system) to identify groups of pages for another reason, so I could extend that idea. And I could also use layouts a bit more than I do, and go for the multiple master pages. I now know I'm thinking along the right lines and haven't missed an alternative I didn't know about.

Thanks again.