MyBB Community Forums

Full Version: Custom Template
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
If one makes a custom template in a particular theme, how do you add that template to current templates for it to "show up" like on the index or portal page template.



Thanks,

Jaxdoug
If you make a global template called "myglobaltemplate" open global.php, and find:
$templates->cache($db->escape_string($templatelist));
After that, add:
eval("\$test_template = \"".$templates->get("myglobaltemplate")."\";");

Then you will be able to use {$test_template} in the index or portal templates
Thanks Dennis, worked like a charm, I wanted to put thumbs of my themes after the header and before the forum and it worked great. Now Can I make as many templates as I want and how would I name them? I understand how to make a template, but what about the {$test_template} part?

Thanks again,

Doug
Taking this code as an example:
eval("\$test_template = \"".$templates->get("myglobaltemplate")."\";"); 

The $test_template is the variable that you will use in other templates to show the contents of the myglobaltemplate template.

Thus if you have

eval("\$test_template = \"".$templates->get("myglobaltemplate")."\";"); 
eval("\$just_for_fun = \"".$templates->get("mybbisthebest")."\";"); 

The {$just_for_fun} in the templates will be replaced with the contents of the "mybbisthebest" template.

Do you get it?
Hey Dennis when I add
eval("\$test_template = \"".$templates->get("myglobaltemplate")."\";"); 
to my global.php it does make the template appear where I want it, but when I click a link in the Last Post of the Forum Display it takes me to this: CLICK HERE

I know it is the global.php doing this because I removed the code you gave me from the global, and the Last Post works......I just know you love problems.....

UPDATE: I had to reinstall my board, seems the code I put in the global php affected more things than I thought, I even messed up my download files I had in my themes section. Can you give me anymore advice?


Doug
I used the Welcome header mod to display my theme thumbs.

See Jaxdoug's Themes & Graphics


Thanks Dennis for your help.

Doug