Форумы / Cotonti / Extensions / Xtemplate Nesting Question

Templates in Templates

ez
#1 08.04.2010 17:39
This question is for plugins.

Is there a way to have a main template and insert a part in there that comes from an
other template..

MAIN
some main stuff here
{OUTPUT_FROM_ROWS_TEMPLATE}
MAIN

So the ROWS part of the main.tpl is build in a separate template (main.rows.tpl)
Is this possible, and if so, what is the best way to do this ?

So maybe it is just get the HTML code from a processed Template, and insert that
into another template with a TAG???

Added 1 hour 8 minutes later:

I found it when digging into the code :):
$rowtemplate->text();

I can use this for AJAX calls to change the ROWS data based on some criterea..
Like data filters..
==- I say: Keep it EZ -==
Отредактировано: ez (08.04.2010 18:50, 15 лет назад)
Trustmaster
#2 09.04.2010 00:38
Includes have been in XTemplate since Seditio:
<!-- BEGIN: MAIN -->
...
<!-- BEGIN: ROW -->
{FILE main.rows.tpl}
<!-- END: ROW -->
...
<!-- END: MAIN -->
It works like include in C, so it just puts the contents of main.rows.tpl in place of the FILE directive and then continues parsing the template.
May the Source be with you!