MyBB Community Forums

Full Version: How to create a template?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I want to add some code directly below the "{$header}" line, for every time it appears in every template, and given the fact that that code will probably need to be updated from time to time, I thought it would be a good idea to create a template/variable with that code.
I added a new template with the name "example" (and inserted my custom code there) and now I can see it in the "Ungrouped Templates" section, but when I add "{$example}" below the "{$header}" line, my custom code doesn't appear on my webpage. Do I have to declare the "$example" variable anywhere else in order for it to work?

Nevermind... I fixed it! Smile

I just had to add this line inside the "global.php" file:

eval("\$example= \"".$templates->get("example")."\";");