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.

Menus hardcoded and too static!?

April 21, 2008 7:41pm

Subscribe [5]
  • #1 / Apr 21, 2008 7:41pm

    StR@ng3r

    12 posts

    EE seems to be great at having many different pages with completly different layouts. In EE every single page can look different due to its templates. However, there’s one thing I don’t like and I hope I just haven’t found a solution for yet.
    Menu entries seem to have to be hardcoded into the templates, don’t they? Let’s say I have 50 pages using about 15 different templates to dynamically output the content. Well, let’s say I have a navigation element called home at the top left corner of every single template. Now I decide that I want this to be called “News” instead of “Home”.

    In every other CMS I know, I have some sort of menu editor that simply let’s me create navigational menus that can then be called in templates/called in module positions or whatsoever… So in other CMS there’s one central place where I can change menu items which are then applied to every page/template on which that particular menu is called.

    Am I right that in EE I would have to manually alter every freakin’ single template if all I want to do is only change one button in a menu that’s called on every template?

    Is there a way to create a menu once and include it in a template? So that if I ever need to change something regarding that menu I will only have to do it once since it is only one menu that is used in many templates instead of many templates with their own navigation?

    Thanks for your help.

  • #2 / Apr 21, 2008 8:05pm

    Lisa Wess

    20502 posts

    Welcome to the forums, Stranger.

    You might like to search the docs for “embed” - you’ll find this useful feature.

  • #3 / Apr 21, 2008 8:07pm

    Sue Crocker

    26054 posts

    Welcome to the ExpressionEngine forums, .(JavaScript must be enabled to view this email address).

    Is there a way to create a menu once and include it in a template? So that if I ever need to change something regarding that menu I will only have to do it once since it is only one menu that is used in many templates instead of many templates with their own navigation?

    There sure is. You can embed templates within other templates.

    I usually create a template group call include. In there I create templates like include/footer, include/leftnav, include/topnav, etc.

    EEDocs:// Embedding Templates

  • #4 / Apr 21, 2008 8:57pm

    StR@ng3r

    12 posts

    Thank you!

  • #5 / Apr 22, 2008 6:12am

    Ingmar

    29245 posts

    EE seems to be great at having many different pages with completly different layouts. In EE every single page can look different due to its templates.

    Not necessarily; seems as though you are caught in a “every page = one template” conception. That’s simply not true.

    Menu entries seem to have to be hardcoded into the templates, don’t they?

    A number of different ways. Most people use categories to some degree, and there are a number of plugins and extensions.

    Let’s say I have 50 pages using about 15 different templates to dynamically output the content. Well, let’s say I have a navigation element called home at the top left corner of every single template. Now I decide that I want this to be called “News” instead of “Home”.

    You will be using sub-templates, of course, or global variables, or both? In this case, simply change “Home” to “News”.

    Am I right that in EE I would have to manually alter every freakin’ single template

    Certainly not.

    Is there a way to create a menu once and include it in a template?

    You are not limited to menus, of course (I use them for headers, footer, sidebars, really all kinds of content), but you are looking for embedded templates. In addition, you might find global variables and the newly added Fresh variables useful.

    ETA: Too late, huh? 😊

  • #6 / Apr 22, 2008 8:19am

    Sue Crocker

    26054 posts

    You are not limited to menus, of course (I use them for headers, footer, sidebars, really all kinds of content), but you are looking for embedded templates. In addition, you might find global variables and the newly added Fresh variables useful.

    Not at all. You added value by putting in the links to global variables and Fresh variables. 😊

  • #7 / Apr 22, 2008 8:32am

    Andy Harris

    958 posts

    Check out the tutorial link in my signature. I’d suggest you have a look through that, you’ll get a much better picture of what’s what.

  • #8 / Apr 22, 2008 12:21pm

    ak4mc

    429 posts

    Not necessarily; seems as though you are caught in a “every page = one template” conception. That’s simply not true.

    Also, with conditionals you can make any template look very different depending on content. Consider these two pages, both created from the same template:

    A post on my own weblog.

    A post on my wife’s weblog.

    Both use the comments template in the “zone” template group. Conditionals and embeds change the header, sidebar and color scheme.

    Updated June 2009: I long since divvied out the two weblogs into separate template groups. And that domain, McGehee.cc died months ago in favor of the original one I’ve owned since 1996. For anyone really interested, those entries are now here and here, respectively.

    But the fact remains I was able to make the same template look as different as those two pages do, using just conditionals.

  • #9 / Apr 22, 2008 5:20pm

    Sanity11

    314 posts

    If you are going to figure out how to embed templates for a menu I would certainly check out the variables you can pass : Have a look here.

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

ExpressionEngine News!

#eecms, #events, #releases