Log in

View Full Version : How do I call one template from another?


Saphrym
03-01-2005, 09:55 PM
Ok. I'm new to all of this, so I've got a question:

I'm working on the Header template and inside of it I have managed to create a column on the left where I want to put a seperate menu from the navbar. That's easy enough to do, but I want to create 3 child styles. I do not want to have to extensively edit each of the four styles everytime I make a change to a portion of the header that should be the same for all four, so I'd like to call SEPERATE templates in the Header one.

Is this possible?

I.E. Header includes MenuTop, MenuMiddle, and MenuBottom.

Being new and all, I thought I could call one template from another just by sticking a $ in front of the template title (I.E. $MenuTop). But that didn't work.

Is there a way to actually duplicate that?

Brad
03-02-2005, 02:16 AM
You need to edit global.php :)

Find this:

// the really important ones
'header',
'footer',

Replace with:

// the really important ones
'header',
'footer',
'menutop',
'menumiddle',
'menubottom',

Then find:

eval('$header = "' . fetch_template('header') . '";');

Replace with:

eval('$menutop = "' . fetch_template('menutop') . '";');
eval('$menumiddle = "' . fetch_template('menumiddle') . '";');
eval('$menubottom = "' . fetch_template('menubottom') . '";');
eval('$header = "' . fetch_template('header') . '";');

You then need to create 3 new templates named 'menutop', 'menumiddle', 'menubottom'. Once you have added the templates you can call them via the header template with the following vars:

$menutop
$menumiddle
$menubottom

Saphrym
03-02-2005, 02:16 AM
Thank you so much. I was starting to get desperate. :) You're a life saver. (Literally. The organization I'm doing the site for would have killed me if I didn't get this done. But you didn't hear it from me. ;) )