![]() |
Call a template in another template!
Hi, I've a template called "mytemplatetest", and I want call it in another template, if possible. I've try with $mytemplatetest (viewing the called $footer, $header, etc., templates), but it doesn't work.
Can you please help me? Best regards, Mr Pink (aka Norman) Web City Forum Online http://www.web-city.it/ |
You can't include other template files in a template file, you need to parse it separately in php code.
If you want to include that template on every page, then open global.php, find this: Code:
$globaltemplates = array_merge($globaltemplates, array( Then find this: Code:
// parse some global templates Code:
eval('$mytemplatetest = "' . fetch_template('mytemplatetest') . '";'); Or write a hack that uses "parse_templates" hook to parse your template. |
Thanks really for your reply, CyberAlien.
So I need to put the entire code into the navbar template (I'm making a style, and I don't want use external files/modifications). :( |
There is another solution: replacements. Create replacement like "<my-header>", put your code in it, then use <my-header> in navbar template. < and > in replacement name are there to make sure there isn't any similar text within posts so nothing else will be replaced.
|
The problem is that I'm trying to do a vB style that I'll posting here like a simple release (I'm doing it for learn coding and take familiarity with vB), so I can't use other resources rather then the simple template modification.
|
Replacements are simple template modifications that you can safely use.
|
If a user will download the style, then he will need to add the replacement, right?
|
No, it will be in xml file.
|
Oh, so I can use them. Great! I thought that users had to add them by themselves! Ok ok, great! Thanks again man. Now my problem is that in the other thread in this forum! :)
|
All times are GMT. The time now is 07:41 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|