Categories > TinyButStrong general >

Blank Pages when using subtpl

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Mbutomax
Date: 2007-07-05
Time: 19:27

Blank Pages when using subtpl

I've often the need to understand why I got a useless blank html page as a result.
Let me show you my case:

main prg: index.php
it just calls a template:
    $TBS = new clsTinyButStrong;
    $TBS->LoadTemplate($Template_dir.'tbs_AllInOne.tmpl');
    $TBS->Show() ;

tbs_AllInOne.tmpl:
...omitted...
        <div id="menulist">
        [onload;script=sub_menu.php;subtpl]
        </div>
       
        <div id="bodypart">
        [var.Messaggio;htmlconv=no]
        [onload;script=sub_view.php;subtpl]
        </div>
...omitted...

Now... I really got stucked!!!
I can't really understand why I get a blank page calling the sub_view.php,
while I get a full and correct answer from calling sub_menu.php.
If I launch the script by themself I get the correct results from both.
Both the scripts do quite the same thing.
sub_menu.php (the one that does what I expect)
<?php


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

include('lib/vars.inc');
global $LOGGED;
global $userParms;
global $Messaggio;

if ($_SESSION['logged'] == 0) {
    $Messaggio="viene fuori quando non sono loggato";
} else {
    $qry_str="SELECT descr, codice  from gradi where id_grado=(select id_grado FROM utenti WHERE nick = '".$_SESSION['nick']."')";
    $userParms = query_DB($qry_str);
}

$TBSa->LoadTemplate($Template_dir.'21_menu.tmpl') ;

$TBSa->Show() ;
?>

and the other script (the 'damned one'):
<?php


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

include('lib/vars.inc');
include('lib/common.db.inc');

global $LOGGED;

$qry_str='select e.id_evento, e.data_evento, c.rag_soc, concat(u.cognome,\', \',u.nome) as nome, e.descr as edescr, e.note, s.descr as sdescr from eventi e, ana_cli c, stato s, utenti u where e.id_cli=c.id_cli and e.id_utente=u.id_utente and e.id_stato=s.id_stato';

if ($_SESSION['logged'] == 0) {
    $Messaggio="viene fuori quando non sono loggato e chiamo la pagina view";
} else {

    $TBSa->LoadTemplate($Template_dir.'tbs_view.tmpl') ;
    $conn_al_db=db_connect();
    $TBSa->MergeBlock('blkView',$conn_al_db,$qry_str);
    $TBSa->Show() ;
}

?>

By the way, probably I wasn't so clear in the examples above.
But the one think I really have to know is: how can i manage the blank pages,
because i don't have any feedback to debug the errors I made.

Thanks in advance for any help.
By: Mbutomax
Date: 2007-07-05
Time: 19:58

Re: Blank Pages when using subtpl

I found that the problem is here
include('lib/common.db.inc');
If I use include_once all seems to go well...

Any explanation?
By: Skrol29
Date: 2007-07-06
Time: 16:49

Re: Blank Pages when using subtpl

Hi,

In an error occurs during the sub-template then the main script stops and a blank page is displayed because all output is stored in the PHP buffer.

When you do the include() instead of include_once(), you probably declare some functions twice and PHP met an error. That TBS will never display.....
By: Mbutomax
Date: 2007-07-06
Time: 16:59

Re: Blank Pages when using subtpl

Yes,
probably because I already included the file in main script...
Now it's all well.
From this issue on I didn't encounter any other problem...
... till now... but never say never... :-D

Thank you very much Skrol