Categories > TinyButStrong general >

Template IN Template ?

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Aaron Mueller
Date: 2003-08-07
Time: 01:01

Template IN Template ?

Hi all!

First of all: TinyButStrong is coooool ;)
So, my Problem:

I have made a "index.tpl.html" with a basic Table-Structure and some mergeBlocks. Now i would like "include" the "action-script-file" who should included in a cell on the index.tpl.html-template. If I include the file with like this: [tbs_include.onload;script=[var.action_source]], the PHP-Output is  above the Template-Output ;(

What is to do ? :(

(Sorry for my bad englisch, i am german)
By: Skrol29
Date: 2003-08-07
Time: 01:06

Re: Template IN Template ?

Hi Aaron,

There is also [tbs_include.onshow;...]
Is that what you need ?
By: Aaron Mueller
Date: 2003-08-07
Time: 01:51

Re: Template IN Template ?

sorry this is not the Problem...
Here an example:

I had 4 Files
index.php
news.php
index.tpl.html
news.tpl.html


index.php
<?php

include_once( "tbs_class.php" );

$source = $_GET['page'];
if( !isset($_GET['page']) || !file_exists($_GET['page']) )
{
    $source = "error.php";
}

$tpl = new clsTinyButStrong;
$tpl->LoadTemplate( "index.tpl.html" );

$tpl->MergeField( "test", "This is a string from the index.php" );

$tpl->Show();

?>

The Templafte for the index.php with an table with 2 cells:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> The Base-File </TITLE>
</HEAD>

<BODY>

<TABLE>
<TR>
    <TD>HERE THE NAVIGATION ... [test]</TD>
    <TD>[tbs_include.onload;script=[var.source];getob]</TD>
</TR>
</TABLE>

</BODY>
</HTML>

Then the "source" with will be included in one of the cells, the news.php
<?php

$tpl2 = new clsTinyButStrong;
$tpl2->LoadTemplate( "news.tpl.html" );

$tpl2->MergeField( "news", "HOT NEWS, Aaron had problems with his script!" );

$tpl2->Show();

?>

ans the Template for the news.php
<b>Big</b> News!!<br>
[news]

So, if I call "index.php?page=news.php" in the WebBrowser, the script parse only the news.tpl.html and show only this file ... the index.tpl.html  DONT show ;(

Know somebody the answer of my problem ?
By: Skrol29
Date: 2003-08-07
Time: 02:17

Re: Template IN Template ?

The script stops just after the $tpl2->Show().
If you want the script to don't stop and continue the main merge, you have to set :
  $tpl2->Render = TBS_OUTPUT ;
before to do
  $tpl2->Show() ;

By default it is TBS_OUTPUT + TBS_EXIT.

Tell me if it works better with this.
By: Aaron Mueller
Date: 2003-08-07
Time: 14:32

Re: Template IN Template ?

Yeah it works!
Thanks Thanks Thanks! ;)
aaron