Categories > TinyButStrong general >

TBS object in another object

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: bunak
Date: 2004-03-17
Time: 12:31

TBS object in another object

pls help me, I tried insert TBS object in another object. All methods works except all merging methods. It means after Show() I have got only template without merged variables or blocks.

Thanks a lot
Vladimir

class clsProduct
{
//constructor
function clsProduct() {
   include_once('tbs_class.php') ;
}


function UpdateProduct() {
  $TBS = new clsTinyButStrong;
  $TBS->LoadTemplate('test.tpl.htm',False) ;    
  $hodnota = 5555;
  $TBS->MergeSpecial('var');
  $TBS->Show();
}

}

//and call them
$CP = new clsProduct;
$CP->UpdateProduct();

?>

in test.tpl.htm there is only 3 rows
<body>
[var.hodnota]
</body>
By: Condutiarii
Date: 2004-03-17
Time: 21:58

Re: TBS object in another object

You must set your variable to global ! In your code, this variable $hodnota is local. Try it !

class clsProduct
{
//constructor
function clsProduct() {
   include_once('tbs_class.php') ;
}


function UpdateProduct() {
  global $hodnota;
  $TBS = new clsTinyButStrong;
  $TBS->LoadTemplate('test.tpl.htm',False) ;
  $hodnota = 5555;
  $TBS->MergeSpecial('var');
  $TBS->Show();
}

}

//and call them
$CP = new clsProduct;
$CP->UpdateProduct();

?>
By: bunak
Date: 2004-03-18
Time: 08:41

Re: TBS object in another object

Thanks a lot, it works, but I solve it before by including TBS class not in constructor but before  first using.
Vladimir