Categories > TinyButStrong general >

A big error, needs help please

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: tdh
Date: 2003-10-02
Time: 23:06

A big error, needs help please

I need some help here please guys. I will start by posting up the files.

list.tpl
[tbs_include.onshow;file=[var.htmlfile];script=[var.phpscript];once]
<p><table border=0>
<tr><td align=right>
<table border=0 cellpadding=0 cellspacing=0><tr><td><small>Order by:&nbsp;</small></td><td><form method=post action="list.php"><select name=order_by onChange="document.location.href='list.php?order_by='+this.value">
<option value="list.php?page=1&order_by=sort">User level</option><option value="list.php?page=1&order_by=username">Username</option><option value="list.php?page=1&order_by=sort+DESC" selected>User level (reversed)</option><option value="list.php?page=1&order_by=username+DESC">Username (reversed)</option>
</select><noscript> <input type=submit value="Go"></noscript></form>
</td></tr></table>
<table border=1 cellspacing=0 cellpadding=0>
<tr><td>
<table border=0 cellpadding=2>
<tr>
<th class="head">#</th><th class="head">User name</th><th class="head">Level</th><th class="head">Email</th><th class="head">ICQ</th><th class="head">AIM</th>
</tr>

<tr>
<td class="one">[list.#]</td>
<td class="one"><a href="userinfo.php?id=[list.id]">[list.username;block=row]</a></td>
<td class="one">[list.userlevel]</td>
<td class="one"><small><a href="mailto: [list.email]">[list.email]</a></small></td>
<td class="one">[list.icq]</td>
<td class="one">[list.aim]</td>
</tr>

<tr>
<td class="two">[list.#]</td>
<td class="two"><a href="userinfo.php?id=[list.id]">[list.username;block=row]</a></td>
<td class="two">[list.userlevel]</td>
<td class="two"><small><a href="mailto: [list.email]">[list.email]</a></small></td>
<td class="two">[list.icq]</td>
<td class="two">[list.aim]</td>
</tr>

</table>
</td></tr>
</table>
[list.#] members.
</td></tr>
</table></p>
[tbs_include.onshow;file='footer.tpl']

list.php
<?

include_once("tbs_class.php") ;

$htmlfile = "header.tpl";
$phpscript = "header.php";

$current_area = "Member List";

require('cnx_mysql.php');

$TBS = new clsTinyButStrong ;
$TBS->LoadTemplate("list.tpl") ;
$TBS->MergeBlock("site",$cnx_id,"SELECT * FROM a_site") ;
$TBS->MergeBlock("usr",$cnx_id,"SELECT * FROM a_users WHERE id='1'") ;
$TBS->MergeBlock("list",$cnx_id,"SELECT * FROM a_users") ;
mysql_close($cnx_id) ;
$TBS->Show() ;

?>

header.php:
<?

include_once("tbs_class.php") ;

$current_area = "Header";

require('cnx_mysql.php');

$TBS = new clsTinyButStrong ;
$TBS->LoadTemplate("header.tpl") ;
$TBS->MergeBlock("site",$cnx_id,"SELECT * FROM a_site") ;
$TBS->MergeBlock("usr",$cnx_id,"SELECT * FROM a_users WHERE id='1'") ;
mysql_close($cnx_id) ;
$TBS->Show() ;

?>

Theres also a header.tpl but i dont see why that needs to be posted.
The problem i am having is it is cutting off the code after the include header. so when i view list.php all i get is the header source. Can anybody tell me how to correct this? Thanks in advance for any help given.
By: tdh
Date: 2003-10-04
Time: 14:02

Re: A big error, needs help please

nobody can help? :'(
By: Skrol29
Date: 2003-10-06
Time: 09:20

Re: A big error, needs help please

I'm looking...
By: Skrol29
Date: 2003-10-06
Time: 09:44

Re: A big error, needs help please

Hi Tdh,

The behavior you've got is normal for three reasons.

First: the sub-script 'header.php' preforms a template merge and then exit the script. The main script never ends.
This is because of the line $TBS->Show();
In order to avoid the sub-script ending, you can use
$TBS->Render = TBS_OUTPUT ;
(The default value is TBS_OUTPUT + TBS_EXIT)

Secondary: in the sub-script, you use the same $TBS global variable for the two mergings. That is bad.

Third:
The sub-template 'header.tpl' is in double because you have it in the tag (file=[var.htmlfile]) and also in the sub-script.
I suggest that you have it only on the sub-script and make the result to display at the tag place using the 'getob' parameter:
[tbs_include.onshow;script=[var.phpscript];getob]

Enjoy,