Categories > TinyButStrong general >

Conditional sub-templates?

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Morrigan
Date: 2004-11-11
Time: 22:59

Conditional sub-templates?

Hi,
Is it possible to include a sub-template conditionally? Something like this:

if ($var == 1) include("subtemplate1");
else if ($var == 2) include("subtemplate2");

I looked around with conditional statements and subtemplates, but I haven't found a way...

Thanks.
By: Skrol29
Date: 2004-11-12
Time: 03:05

Re: Conditional sub-templates?

Something like this can work:
[onload;file=[var.id;if [val]=1;then 'subtemplate1';else 'subtemplate1']]

But if the sub-template selection is very complicated, then you can calculate it in the PHP side, and then use a variable:
[onload;file=[var.tplname]]
By: Morrigan
Date: 2004-11-12
Time: 21:23

Re: Conditional sub-templates?

Thanks for the help!