Categories > TinyButStrong general >

Variable probs

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Radeon
Date: 2004-08-02
Time: 15:42

Variable probs

I have been looking trough the examples and the manual but i can't find an answer on how i include a variable in by templates.

I have created

$user = $_SESSION['user_nick'];

And i would like that to echo at a specific place in my html table.

Thx for any help.
By: Skrol29
Date: 2004-08-02
Time: 15:49

Re: Variable probs

Hi,

  [var.user]
or
  [var._SESSION.user_nick]
By: Radeon
Date: 2004-08-02
Time: 17:35

Re: Variable probs

Thx, got it working =)
By: RwD
Date: 2004-08-04
Time: 09:03

Re: Variable probs

I am looking into how people lookup information to make this stuff more accessible or intuitive, and this question intrigues me.

Please do not take offence, but I am wondering how you looked at the examples and what you didn't get from the manual so you didn't look it up in there. Half of the examples have the [var. tag in, and the Manual writes the text below my name..

And perhaps interesting to Skrol29: What do you think should be changed to make it clearer for you and others?
I myself might want to suggest a step by step tutorial that explains every step along the way for the most absic things like what you ask here...

Curious,
  RwD

PHP variable Fields:
A Php variable Field is a TBS Field which display a Php variable.
The name of it must be composed by the keyword 'var.' followed by the name of the Php variable.
The parameters for standard TBS Fields are available for Php variable Fields.

For example [var.php_version] will be replaced by "4.2.3".

The user variables and the predefined variables can be merged but they must be global variables. Object or Resource variables are ignored.

It is possible to merge an Array variable by indicating the item with a dot.
For example: [var.myarray.item]

It is possible to merge an Objet variable by indicating a property (or a method which doesn't need any argument) with a dot.
For example: [var.myobject.property]


When are Php variable Fields merged?
Php variable Fields are merged in the Show() method, this means just before displaying the merge result. But you can force the merge at any time with the MergeSpecial() method.
By: Skrol29
Date: 2004-08-04
Time: 16:09

Re: Variable probs

Hi RwD,

The manual has also a "mini example" section, showing how to display "hello word". Manual and example seam very clear to me about how to display PHP variables, but I distrust them because I wrote them.
I'm still taking care about how to make them clearer. But it's a big work, you know. I know some new sections are wanted in the example set. A tutorial is wanted too.
May be a "First steps" example could make people getting basic tricks faster. May be "Mini example" in the manual should be renamed into "First step".
By: Radeon
Date: 2004-08-04
Time: 16:23

Re: Variable probs

I did try the [var.$variable] thing first, but i couldn't get it working, so i asked here. And then i tried some more, and i found out that it only reads global variables, i had made a function but it would't read variables from the frunction...
By: Pirjo Posio
Date: 2004-08-04
Time: 23:10

Re: Variable probs

To make this clearer maybe this should be added:
a warning not to use $ sign

- Pirjo
By: michael
Date: 2004-08-05
Time: 09:02

Re: Variable probs

Skrol29

> The manual has also a "mini example" section, showing how to
> display "hello word". Manual and example seam very clear to me
> about how to display PHP variables, but I distrust them because I
> wrote them.

It is very clear. I think the manual & examples are excellent - no need to feel so distrustful of your excellent work there. It seems that the issue is simply people are not reading the manual properly, since the explanatory info is in there. Doing piece-by-piece and simple experimentation along with the manual is the best way to learn in my opinion - what I am doing personally.

Regards

Michael.