ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

template "system"

June 29, 2012 3:50pm

Subscribe [2]
  • #1 / Jun 29, 2012 3:50pm

    vodkafish

    122 posts

    I’m wondering how everyone creates re-usable templates.

    I have some common includes the the head, header, footer, etc., but what about the actual “frame” of the page.

    To simplify: I have a few different templates I use and I’d like to be able to define them in some manner and then just create the content areas in each EE template.  That way, if I make a true global template change I only make it in a few spots, instead of every template.

    <html>
    <head>
    <!-- head include -->
    </head>
    <body>
    <!-- header include -->
    content
    <!-- footer include -->
    </body>
    </html>

    I could have that on every page now.  Let’s say I wanted to add something, like a wrapper div (or I wanted to change the class of it), I would need to edit every template and there are tons, even though most are using the same structure.

    What’s the best way to accomplish this in EE?  I’ve tried searching, but I think the word template being used in different ways here is throwing off the results.

  • #2 / Jun 29, 2012 8:08pm

    boldyellow

    89 posts

    It sounds like one approach might be template partials using Stash.  You may already know about them as I’ve been seeing a lot about the topic lately here in EE-land. 

    It’s like a “shell” or “bucket” with all your common items and then you just drop in various unique content templates.  It’s supposed to be easier to manage and perform better than embeds.

    I found these posts very helpful:
    Using Stash for the First Time
    Template Partials using Stash

  • #3 / Jun 30, 2012 11:17am

    vodkafish

    122 posts

    Thanks, the Template Partials using Stash article by Adrienne Travis was very on-point with what I was looking to do.  I was reading a ton about Low Variables last night, thinking I might be able to do what I want with that, but perhaps Stash is the way to go.  Low looks good for a few other things I want to do.  Attempting not to install too many add-ons, but there’s some good stuff out there 😊

    Thanks again.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases