Categories > TinyButStrong general >

Totally confused with SubTemplates

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Philip
Date: 2005-08-18
Time: 03:11

Totally confused with SubTemplates

Here is what I want to do...

I want a template file called default.html to include another template file called php.tpl

PHP.tpl has some PHP commands do grab some data from a database and echo it out etc.

How would I do this? Also is their anyway of "simplifying" the tags used? Like instead of [var.Name] just use [name]?

If their is a better template system to suit my needs PLEASE reccomend it...Thanks
By: Skrol29
Date: 2005-08-18
Time: 10:03

Re: Totally confused with SubTemplates

Hello,

> PHP.tpl has some PHP commands do grab some data from a database [...]

Your template shouldn't have Php commands when you are using a Template System. You should do this job in the PHP side only.
If you want the sub-template to have commands specific to it, then you can use parameters 'script' and 'subtpl' together. This enables you to run a specific function or script for merging the sub-template part like if it was a normal template.

>Also is their anyway of "simplifying" the tags used?
>Like instead of [var.Name]

Yes and no. 'var' is an internal keyword that cannot be modified.
But You can merge a sries of fields names as you wich using MergeField().
For example : $TBS->MergeField('$',$_GLOBALS);
will merge all fields like [$.name] in one shot.