Categories > TinyButStrong general >

A little problem with [var.]

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Carlo Mengarelli
Date: 2014-07-27
Time: 15:43

A little problem with [var.]

I've a .php file:
$firstname = "Carlo";
$lastname = "Mengarelli";

then, I've a .html file:
<h1>Hello [var.firstname] [var.lastname], welcome!</h1>

and the result is:
Hello Carlo Mengarelli, welcome!

BUT... if not set the variables ($firstname and $lastname), this is the result:
Hello [var.firstname] [var.lastname], welcome!

I can resolve with this method:
<h1>Hello [var.firstname;noerr] [var.lastname;noerr], welcome!</h1>

Can I set this for ALL variables?

Thank you!

 
By: zixxus
Date: 2014-07-27
Time: 17:10

Re: A little problem with [var.]

template:
hello [person.firstname][person.lastname], welcome

code

$person=array();

$person = array(
'firstname'='Carlo',
'lastname'='Mengarelli',
)


in tbs merge

$TBS=mergeblock('person','array','person');
By: Carlo Mengarelli
Date: 2014-07-27
Time: 17:24

Re: A little problem with [var.]

Thank zixxus for your answer, but you don't have understand my problem (sorry for my english!!).

I don't want to see the name of var ([var.firstname] or other) into my html page .. IF THE VAR IS EMPTY.

I can resolve this using NOERR:

<h1>Hello [var.firstname;noerr] [var.lastname;noerr], welcome!</h1>

But, if I've more and more variables into all my html page......

There is a SETTING to use for ALL NOERR?
By: Skrol29
Date: 2014-07-27
Time: 20:18

Re: A little problem with [var.]

Hi Carlo,

Var fields outside a TBS fields are deprecated.
It is better to use [onload] or [onshow] fields.

In oder to have noerr feature at anytime, you can use option "noerr".
See http://www.tinybutstrong.com/manual.php#php_setoption_noerr