Categories > TinyButStrong general >

accessing a variable from the html

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: RJJesus
Date: 2005-09-27
Time: 16:12

accessing a variable from the html

Like in the first example, I tried to access the variable message, writting [var.message] in the html template. When I try it in the browser, it apears [var.message] written, instead of the content of the variable. Can anyone help me on this? Thank you all.
By: Skrol29
Date: 2005-09-27
Time: 16:59

Re: accessing a variable from the html

Hello,

Can you provide more details,
what is your script ?
By: RJJesus
Date: 2005-09-27
Time: 17:02

Re: accessing a variable from the html

I´ve done two files, just like the first small example from the manual and I can´t see the content of the variable in the browser.
By: Skrol29
Date: 2005-09-27
Time: 22:35

Re: accessing a variable from the html

Sorry, I miss clues to help you.

What is the URL you open in the browser ?
What is the source of your script ?
By: RJJesus
Date: 2005-09-28
Time: 09:23

Re: accessing a variable from the html

In the php file that starts the aplication I have :
include_once('tbs_class.php');
$TBS = new clsTinyButStrong;
$TBS->LoadTemplate('template.htm');

when I'm going to show the message, in the php file I have:
$message = 'Hello world';
$TBS->Show();

In the template.htm :
<html>
  <body>
     [var.message]
  </body>
</html>

In the browser, when 'Hello world' should appear, it shows [var.message]
By: Skrol29
Date: 2005-09-28
Time: 10:44

Re: accessing a variable from the html

This is very strange.
Can you try an
   echo $message;
just before the
   $TBS->Show();
? An tell the result.

Alos try:
  $TBS->MergeSpecial('var');
before the Show();
By: RJJesus
Date: 2005-09-28
Time: 10:52

Re: accessing a variable from the html

Making echo($message); shows HelloWorld in the browser.
With the $TBS->MergeSpecial('var'); returns the same result.
THanks
By: Skrol29
Date: 2005-09-28
Time: 11:07

Re: accessing a variable from the html

Hi RJJesus,

A French user had such a problem. After a long debugging, we found that the problem came from a Php installation with the extension ZendOptimizer which is not up to date.
   Related information: http://bugs.php.net/bug.php?id=31150
This has been observed with Php 4.3.10 but it can occur with other versions too. This problem is not related to TBS but to the Php/ZendOptimizer and can affect all Php script.

There is a simple test to know if your are under this problem. Just try the following code:
$array = array(1,2,3);
foreach ($array as $value) {
  echo (is_array($value)) ? "bad " : "good ";
}

Correct result is :
  good good good

If you have the problem, it prompts :
  bad bad bad
By: RJJesus
Date: 2005-09-28
Time: 11:13

Re: accessing a variable from the html

All I had was "good good good "...I'm really banging my head.
Thanks friend
By: Skrol29
Date: 2005-09-28
Time: 11:20

Re: accessing a variable from the html

Ok :(

If you want, I can try a debuging with you but this may take several emails exchanges.
By: RJJesus
Date: 2005-09-28
Time: 11:22

Re: accessing a variable from the html

I´ve tried the second example from the manual and I've got the same problem...I´ll read some txtbooks and try to find something...if I find what's the problem I'll say something...
Thank you friend
By: RJJesus
Date: 2005-09-28
Time: 15:20

Re: accessing a variable from the html

I've made it, all the variables had to be declared as public, instead of var, and called as public.varname