Categories > TinyButStrong general >

Adding a Var to tbs_class.php

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: austin
Date: 2005-02-16
Time: 23:11

Adding a Var to tbs_class.php

I would like to move my .htm templates to a separate directory. I can add the directory structure when load the template in the php file like this:
$TBS->LoadTemplate('templates/tbs_us_examples_datamysql.htm') ;

However, I would prefer to create a variable in tbs_class.php like this:
var $temp_root = 'templates';

Then on load template, I could have something like this:
$TBS->LoadTemplate($temp_root.'/tbs_us_examples_datamysql.htm') ;

I tried that and It is not working. I am sure it is a syntax issue. Any ideas?
By: austin
Date: 2005-02-17
Time: 00:55

Re: Adding a Var to tbs_class.php

I figured this out. Below is what I did.

I added this to tbs_class.php:
// Paths
$tmpl_root = 'templates';

In my php file I put:
$TBS->LoadTemplate(''.$tmpl_root.'/tbs_us_examples_include.htm') ;

For includes (like headers), I put this in my .htm template:
[onload;file='[var.tmpl_root]/tbs_us_examples_include_header.htm']
By: Skrol29
Date: 2005-02-17
Time: 02:33

Re: Adding a Var to tbs_class.php

It should work.
'templates' must be a sub-directory of the main srcipt that call $TBS->LoadTemplat().
Did you tried to check the value of $temp_root just before the call?