Please forgive me if it reposts..
Hi, I’m a new fan of TBS and I would say thanks for TBS that is really a wonderful tool to faster my web development process. But I have a silly question about accessing variable that declared in sub template from HTML. Just imagine if I have code like this..
-- global_var.php --
<?php
include_once(“class/tbs_class.php”);
$global_big_deal = “for whole night ..”;
?>
|
-- main.php --
<?php
include_once(“global_var.php”);
$TBS = new clsTinyButStrong;
$TBS->LoadTemplate('main.html');
$TBS->show();
?>
|
-- main.html –
<html><head></head>
<body>
[onload;script=’sub_template.php’;subtpl]
</body></html>
|
-- sub_template.php –
<?php
// for the simpler code I just post like this
$TBS =& $this;
// in here I can accessing global_big_deal
global $global_big_deal;
$global_big_deal = “mooo ….”;
// I want to declared my own in sub_template.php
$local_big_deal = “lalala…”;
$TBS->LoadTemplate(‘sub_template.html’) ;
$TBS->Show() ;
?>
|
Then I created one HTML page that accessed from sub_template.php, named sub_template.html
-- sub_template.html –
<html><head></head>
<body>
[var.global_big_deal]
[var.local_big_deal]
</body></html>
|
It will show error, $local_big_deal wasn’t set yet.
Isn’t it simpler if I can access local variable from sub_template.html? Cause it called from sub_template.php … Or it's my fault to learn about sub template theories :(
Sorry for my bad English ...