Menus hardcoded and too static!?
Posted: 21 April 2008 04:41 PM   [ Ignore ]  
Summer Student
Total Posts:  20
Joined  04-21-2008

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.

Profile
 
 
Posted: 21 April 2008 05:05 PM   [ Ignore ]   [ # 1 ]  
Moderator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  32921
Joined  05-14-2004

Welcome to the forums, Stranger.

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

 Signature 
Profile
MSG
 
 
Posted: 21 April 2008 05:07 PM   [ Ignore ]   [ # 2 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  12433
Joined  04-29-2002

Welcome to the ExpressionEngine forums, StR@ng3r.

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

 Signature 

Quick Reference - EE Trial Options - EE Wiki - Docs for updating a build

Profile
MSG
 
 
Posted: 21 April 2008 05:57 PM   [ Ignore ]   [ # 3 ]  
Summer Student
Total Posts:  20
Joined  04-21-2008

Thank you!

Profile
 
 
Posted: 22 April 2008 03:12 AM   [ Ignore ]   [ # 4 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15489
Joined  05-15-2004
StR@ng3r - 21 April 2008 04:41 PM

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? grin

 Signature 

Everything will be good in the end. If it’s not good, it’s not the end.

Profile
MSG
 
 
Posted: 22 April 2008 05:19 AM   [ Ignore ]   [ # 5 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  12433
Joined  04-29-2002

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. smile

 Signature 

Quick Reference - EE Trial Options - EE Wiki - Docs for updating a build

Profile
MSG
 
 
Posted: 22 April 2008 05:32 AM   [ Ignore ]   [ # 6 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  887
Joined  02-15-2008

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.

 Signature 

Andy Harris | Pepper Digital | Malvern, UK | Twitter | New to ExpressionEngine? Start here!
Remember - If at first you don’t succeed, you’re not Chuck Norris

Profile
 
 
Posted: 22 April 2008 09:21 AM   [ Ignore ]   [ # 7 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1193
Joined  05-15-2004
Ingmar Greil - 22 April 2008 03:12 AM

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.

 Signature 

Being offended by other people’s opinions is retarded.

Profile
 
 
Posted: 22 April 2008 02:20 PM   [ Ignore ]   [ # 8 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  196
Joined  08-14-2006

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.

 Signature 

http://www.octografx.com

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 65087 Total Logged-in Users: 35
Total Topics: 82229 Total Anonymous Users: 21
Total Replies: 441928 Total Guests: 217
Total Posts: 524157    
Members ( View Memberlist )