PDA

View Full Version : How to show a template in another template?


dutchbb
11-01-2005, 02:04 PM
I want to use a variable in the footer template, so I don't have to paste that html in the footer. So a new template to show in the footer template.

How do I do this please?

Ty

Marco van Herwaarden
11-01-2005, 02:49 PM
Evaluate the new template into a variable using a plugin, then use that new variabl in your footer template.

dutchbb
11-01-2005, 04:07 PM
Thank you for that quick reply Marco. I tried what you suggested, however would it be possible to give more details about where the plugin needs to be made and it's content. Thanks again in front.

T.

Marco van Herwaarden
11-01-2005, 08:02 PM
Put the following in a plugin on the global_start hook:
global $myfooter;
eval('$myfooter = "' . fetch_template('myfootertemplate') . '";');
Now put $myfooter somewhere in the footer template. Create a new template called myfootertemplate and you're done.

dutchbb
11-06-2005, 01:51 PM
Works, thanks

How can I cache this template in global php or do it in a plugin please?

thank you

Detomah
11-06-2005, 06:46 PM
I've spent days trying to figure how to do exactly this. I've tried all sorts of overly complicated things... Bah... Who would have thought it would turn out to be so simple... lol.

Anyway, soz for hijacking your thread, but wooohooo, saves me a mission and a mighty big headache. :up:

dutchbb
11-07-2005, 02:15 PM
ok lol

I just hope Marco knows how to cache it, I can't seem to get that to work in global.php or in a hook .

Marco van Herwaarden
11-08-2005, 03:28 PM
You can find a HOW-TO on caching templates in the vB3.5 How-To forum. :D

dutchbb
11-08-2005, 06:18 PM
sorry :D guess i have to read some more here :)