Categories > Your tips & tricks >

Subtemplates doesn't prints any error :/

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: MichalDCK
Date: 2006-10-19
Time: 12:08

Subtemplates doesn't prints any error :/

Hi all !
I have problem with TBS and subtemplates - included PHP scripts.

Script is included with:
index.tpl
[onload;script=[var.module];subtpl]

somemodule.php:
<?php

if (isset($this)) {
    $TBS =& $this;
} else {
    include_once('tbs_class.php') ;
    $TBS = new clsTinyButStrong;
}

// HERE IS SOME BUGGY CODE

$TBS->LoadTemplate('somemodule.tpl') ;
$TBS->Show() ;
?>

All works great, but when Error apear, in result i have blank page in back.

Any ideas ?
By: Skrol29
Date: 2006-10-19
Time: 18:18

Re: Subtemplates doesn't prints any error :/

Hi MichalDCK,

If the subscript meet a PHP critical error (when run in subtemplate mode), then a blank page is displayed. This is because in this subtemplate mode TBS is catching all output information in order to insert it inside the merged template. Therefore, when the error occurs, the whole script is ended and the PHP error message is lost in buffer which no longer exist.

I suggest that you debug you subscript template by running it in normal mode. The code
if (isset($this)) {
    $TBS =& $this;
} else {
    include_once('tbs_class.php') ;
    $TBS = new clsTinyButStrong;
}
is made for this purpose. It makes the subscript runable in standalone.