Categories > TinyButStrong general >

Why no working??

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: paco
Date: 2004-05-06
Time: 13:44

Why no working??

This code work very fine!!!!

<?
include_once('inc\fjfunc.php') ; //this content tbs_adodb_open,etc....
include_once('class\tbs.cls');
$TBS = new clsTinyButStrong ;
$TBS->LoadTemplate('apu.htm') ;

$TBS->MergeBlock('blk','adodb',"SELECT codart,desart from art WHERE famart='001'");

$TBS->Show() ;
?>

BUT this code no working... this show only the template html

include_once('inc/fjfunc.php');
/*--------- Inicio ----------*/
switch($func) {
    default:
       browse();
       break;
    case "edit":
       ficha($id);
       break;
}

function browse() {
include_once('class\tbs.cls');
$TBS = new clsTinyButStrong ;
$TBS->LoadTemplate('apu.htm') ;

$TBS->MergeBlock('blk','adodb',"SELECT codart,desart from art WHERE famart='001'");

$TBS->Show() ;

}

?>

Where function Browse() is identical than the code working!!!

Excuse my bad english... sorry
By: Skrol29
Date: 2004-05-06
Time: 14:05

Re: Why no working??

Hi,

That's because of the line
  include_once('class\tbs.cls');
placed inside the function.

The TBS class uses some global variables such as $tbs_CurrVal.
If the include statement is placed inside a function, such variables are not globals anymore and the code can fail.

This behavior can be fixed. I'll try to make the change for the next version.
By: paco
Date: 2004-05-06
Time: 14:09

Re: Why no working??

Thanks!!!. Now working fine!!!
By: Hossein
Date: 2011-05-10
Time: 01:18

Re: Why no working??

Hello,

I realize this was a problem from long ago, but I am having the same problem right now.
I have the demo_merge.php in a directory of my website server and if I point to the php file it will do everything that is supposed to do.

But, when I put it inside another php (a function of that php file) nothing works  I did put the include outside the function at the very beginning of the file to no avail.

Any help will be greatly appreciated.
Best Regards,
HoSsEiN
By: Skrol29
Date: 2011-05-11
Time: 22:29

Re: Why no working??

we need more details in order to help you