Grow your CSS skills. Land your dream job.

How do you structure/control a site based on a few template layouts?

  • # November 15, 2012 at 2:30 pm

    Let’s say I have a site that is CMS driven, in that the admin can go in and add pages as needed. Cool I can use .htaccess and make permalinks and do that kinda stuff no prob.

    Now how do you do this if they want to choose from multiple layouts?
    I had a site that did this before I learned about permalinks and SEO goodness, and the url had the template’s name (layout file) and a query string (content id or something). So there I got my layout needed and content requested.

    So let’s say the “About Us” page’s url looked as such (ugly yes, but this is what I did back in the day):
    http://www.cowpie.com/layout-1?pg=23

    Now I’d much rather have a url like this:
    http://www.cowpie.com/about-us

    How do you do this when there are 2+ layout files the admin can choose from without making ugly urls??

    # November 15, 2012 at 2:39 pm

    Most CMSs will allow you to set a template style from the backend edit screen. This will either apply a class that you can hook into or the code will simply be spit out differently.

    # November 15, 2012 at 4:11 pm

    Multiple layouts per site? If so, how do they get this to happen in the backend??

    # November 15, 2012 at 4:27 pm

    Most CMS systems will allow you to choose which template you want to use before deploying a page.

    They’ll most likely all refer to the same assets, like header/footer etc but will have different content regions and different layouts to fill in.

    # November 15, 2012 at 7:49 pm

    If you’re using WordPress, use Custom Permalinks plugin to change the URL.

    If you want to use multiple templates and choose which pages you want those on…I use HeadSpace 2…when you do that, you have to go into the settings, click advanced and add the option to change a theme on certain pages.

    HeadSpace2 is mostly for SEO, but it’s a nice feature they added…which beats the heck out of having to program if(is_front_page) statements on landing pages that have different looks to them than the sub pages.

    # November 16, 2012 at 10:54 am

    I’m more interested in learning how to do this type of thing myself. I could use WordPress, but I enjoy learning things like this.

    As @andy_unleash said, I think the idea of basically flagging the template and then loading design modules is the way it’d have to be done. So you use one file as a skeleton controller that loads things based on which template is chosen. Seems like it’d be an easy enough thing to do.

    And I’ve never seen HeadSpace 2. Thanks for the info!

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".