MyBB Community Forums

Full Version: add (created)template to other templates
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,i want to crate a new template but i cant,according to this topic,i go to this address: Home » Template Sets » Default Templates » Add Template
first i write a name for template forexample: nposttemplate
next i selet Global Templates from choice box,then i write my content in the box below,finally i save and exit,but i cant use from this new template in other templates.

how can i add this (created)template to other templates,even i used {$nposttemplate} but that didnt work.
PLEAse HELp
Hope this helps
eval("\$nposttemplate = \"".$templates->get("nposttemplate")."\";");
If this helps don't forget to rep [Image: postbit_reputation.gif]
tnks alot.
should i make some changes or i should copy this code to destination template without any changes??

sorry that didnt work
Oh sorry I forgot to tell you where to put the code hope you worked it out ok...
I put it in a template,but that didnt work.
Yeah you need to put it in a PHP file.
Open up ./index.php and find
// Otherwise, they've never visited before
else
{
	$lastvisit = $lang->lastvisit_never;
}
Replace with:
// Otherwise, they've never visited before
else
{
	$lastvisit = $lang->lastvisit_never;
}

//my evals start
eval("\$$nposttemplate = \"".$templates->get("nposttemplate")."\";");
//my evals end

You can get rid of //my evals start & //my evals end if you want, but they would be helpful to find the right part of the code, if you want to make more templates
The changes:
eval("\$templateinclude = \"".$templates->get("whattemplate")."\";");

templateinclude should be change to what you want to put in the templates to include it e.g {header} or in this case {$templateinclude}

whattemplate should be change to the template you want to use for example the {$modcplink} would be header_welcomeblock_member_moderator