Log in

View Full Version : Include a template within another template?


Voltar
01-14-2009, 09:09 AM
Is it possible to include a template within another template?

I'm creating a mod for one of my sites that has one generic template to setup a table for display purposes, and then I'd like to include a second template that will be different according to the style. I thought of doing it this way this way to save a template, as the first thought that came to mind was splitting the display template into two, and concatenate the three together to establish what I need.

Here's a code snippet to help visualize this...

<table class="tborder" border="0" width="100%" align="center" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]">
<tr>
<td class="tcat" align="left">blah blah blah</td>
</tr>
<tr>
<td class="alt1">
<!-- CODE TO INCLUDE TEMPATE -->
</td>
</tr>
</table>

Marco van Herwaarden
01-14-2009, 09:26 AM
You will need to evaluate both templates in a PHP script/plugin. Assign the value of template 1 to a variable, and use that variable in template 2.

Voltar
01-14-2009, 09:18 PM
Thanks Marco, it was late and I didn't even think of that.