Master pages NOT go bye-bye

Okay, not sure what I was smoking the other day. But I found a way to overcome some of my frustrations at using master pages for php. Part of the problem was that in using master pages I was also using links relative to the document for everything on the site. This is great because it allows you to see your work locally at any point, either in your localhost or not. And that makes development pretty easy.

Using site-relative links is not so quick and easy. Because I’m running many sites out of my php webroot folder I can’t use that link structure and see anything relevant while I’m developing. BUT it does allow me to finally get the maximum benefit from master pages.

Previously with master pages, I had to have a master page reference for each level of depth in my site. This was the only way to get all elements (css, images, includes) to correctly show. Now with one master page in the root of the directory using site-relative links with a nav include that also uses site-relative links, all pages referencing the root level file are showing correctly no matter if they are one, two, or even three levels deep.

So I’ll admit it – I was wrong, and too quick to abandon the master page idea. The ironic part is that because everything was correctly linked to master pages I just needed to change that link and all was fine. And using a renamed style sheet I was even able to stagger the change of site files over a two day period with no adverse broken files or f**ked up formatting. THAT was the best part.

Master pages again rule. :=)

This entry was posted in PHP General Topics. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

Verification *