Categories > TinyButStrong general >

Sub-Templates

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Felipe Lopes
Date: 2004-12-13
Time: 23:39

Sub-Templates

I have a template that depending on a $_GET var it loads another template...Is it possible to this other template to be interpreted by TBS as the main template is??

If not, how can I over go this issue??

Thx in advance

Felipe Lopes
By: Skrol29
Date: 2004-12-15
Time: 00:24

Re: Sub-Templates

Hi Felipe,

When a TBs tag with parameter 'file' is merged, then the tag is immedialty replaced by content of the file. Then the main template become main+sub.
If such a TBS file is named 'onload', then the sub template is inserted at the end of the LoadTemplate() method.

But, if what you want to do is to simply change change the main template, you can just re-use LoadTemplate() with another file name, and old template will be replaced by the new one.

Don't forget that LoadTemplate() can also add a secondary template to the current one without erasing. This can be done using a option.

For your problem, mabybe something like this can help:
if ($_GET['x']=='1') $template = 'file1.htm';
if ($_GET['x']=='2') $template = 'file2.htm';
if ($_GET['x']=='3') $template = 'file3.htm';
$TBS->LoadTemplate($template);

I hope this help.