MyBB Community Forums

Full Version: Outsourcing a menu
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey, tried to outsource a menu, to a seperate template. I added a template in "global templates" as well as in "Default templates". I called the menu and menu2. After that I added a $menu and $menu2 in the header template, but it didn't show anything. What do I have to do to show it correctly??
If you want $menu to show a template called "menu" and $menu2 to show a template called "menu2" in the header template, then you'll need to open up global.php and find a line that look like this...

eval("\$header = \"".$templates->get("header")."\";");

...and add these two lines before it...

eval("\$menu = \"".$templates->get("menu")."\";");
eval("\$menu2 = \"".$templates->get("menu2")."\";");
Thanx a lot, I will do it. I really supposed that the templates a are variables I can set as I want Smile.
Is there any way of doing this through a theme?
For example, if I wanted to make $copyright
goto a copyright template I've added, is there any way that People who then upload my theme, will have the $copyright working?

do I then have to get them to manually edit their global php as well?
Yeah anythink you modify to global.php for your theme will mean you'll have to get the users that download you theme to modify global.php or anyother .php files that you have edited for your theme.
Netrosis Wrote:Is there any way of doing this through a theme?
For example, if I wanted to make $copyright
goto a copyright template I've added, is there any way that People who then upload my theme, will have the $copyright working?

do I then have to get them to manually edit their global php as well?

Open global.php

find
Quote:eval("\$footer = \"".$templates->get("footer")."\";");

Below it, add:

Quote:eval("\$copyright = \"".$templates->get("copyright")."\";");

Then go to:

ACP -> Templates -> *Template Name* (or Global Templates if you want it to appear on all of your themes) -> Add Template -> name it "copyright" without the quotes

Edit: I forgot this....

After you put in the HTML or whatever you wanted on the "copyright" template I told about above, then place $copyright in the "footer" template on EVERY theme you have (Or just the ones you want it to show up in).
So how to do this on the PR2? That what I want to do

A menu on a couple of pages, because I changed the portal a lot, I want to ousource it to an extra variable. So I want to be able to call it globaly.
Cory, first of all
eval("\$copyright = \"".$templates->get("copyright")."\";");
must be above, not below
eval("\$footer = \"".$templates->get("footer")."\";");
Bill, do what MM said. Thats works!
Ok, thanx a lot, I get the idea Smile and now it works. It works perfectly.