Not Solved Basic question: how to include a custom template into other templates?
#1
Not Solved
We need to include a bit of HTML into our templates, So, we made a new templateName inside Global Templates and tried calling it with {$templateName} but it's not showing up. So we tried putting it in Default Templates/ungrouped, still doesn't work.

How is this done?
Thanks!
Reply
#2
Not Solved
Find
eval("\$header = \"".$templates->get("header")."\";");
And add after
eval("\$TemplateName = \"".$templates->get("TemplateName")."\";");
Reply
#3
Not Solved
Which Php file would that be?
Reply
#4
Not Solved
(2012-12-24, 10:10 PM)Monaco Wrote: Which Php file would that be?

This might be similar to an issue I am trying to resolve in another thread. If I'm understanding Jordan right, he means to simply find that first line of coding in whatever file you're trying to call your new template info in, and then simply paste that 2nd line under it without removing or editing the original line he gave. (but I think he means global.php... see my note below)

If I'm understanding this right, it MIGHT also do what I'm trying to figure out. Basically I've been trying to figure out how to "call" different variables that are created in a different template.

Can a more experienced user chime in and let us know if these issues are similar? Will Jordan's resolution above also make it so any variable created in "TemplateName" can now be called by the file in which he pastes that 2nd line of code?



NOTE: On second thought Jordan may have meant to specifically add that line into the global.php file. Upon a quick search I'm not finding that line he mentioned in any other files than global.php. I've noticed a lot of the answers people give still leave new questions, so I'm right there with you buddy. Smile
Reply
#5
Not Solved
Oh sorry I had that in my post but then deleted it. The file would be ./global.php.
Reply
#6
Not Solved
Interesting...
I tried this. I added the appropriate line in global.php. The template include works in the index template but not in the header template.

In index this works
</head>

<body>
{$header}
{$mycustomtemplate}

In header this does not work
<div id="content">
			{$pm_notice}
			{$bannedwarning}
			{$bbclosedwarning}
			{$unreadreports}
			<navigation>
{$mycustomtemplate}

The goal is to create a template and include it into the header template so that it appears everywhere.

Why doesn't this work?
Reply
#7
Not Solved
Because you need to add the custom line before the header eval line. If the variable is part of the header then the variable must be defined before the header so that its contents are included.
[retired]
Reply
#8
Not Solved
Yeah that makes sense. Thanks.
Reply
#9
Not Solved
Considering that, it would be best to put your custom template evals before the group of them in the global.php file.
Reply
#10
Not Solved
Thank you everyone.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)