Categories > TinyButStrong general >

Condizional display problem [val]

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

Condizional display problem [val]

ho to all!
i have this piece of code:
<area shape ="rect" coords ="678,206,733,248" href ="index.php?page=[var.page]&lang=[var.lang;if[var.lang]='it';then 'en';else 'it']" alt="English" />
that doesn't work as expected (print "en" if the value of the variable is "it" and "it" if the variable is set to 'en').
now, the code seems to ignore everything that is after "[var.lang]" and always displays the actual value without evaluating it.
any help?
By: pistacchio
Date: 2008-05-06
Time: 14:03

Re: Condizional display problem [val]

also:
<area shape ="rect" coords ="678,206,733,248" href ="index.php?page=[var.page]&lang=[var.lang;if[val]='it';then 'en';else 'it']" alt="English" />
doesn't work.

if it helps:
the php page is:
<?
include_once('inc/tbs.php');

$tbs = new clsTinyButStrong;
$lang = 'it';

if (isset($_GET['lang'])){
    $lang = $_GET['lang'];
}

$tbs->LoadTemplate('tmp/index.html','UTF-8') ;
$tbs->Show() ;

?>

tmp/index.html is:
[onload;file=header.html]
[onload;file=home.html]
[onload;file=footer.html]

and home.html is the page containing the non working code.
By: ege
Date: 2008-05-06
Time: 18:48

Re: Condizional display problem [val]

Hi pistacchio,

I wrote something similar yesterday, here I paste my code:

<li><a href='?a=figures&amp;id=[figures.id;block=li;][var.lang;if [val]=='En';then '&amp;lang=En';else '']'>[figures.#]</a> </li>

Above code is working and php part that selects the lang is almost identical. So I see 2 differences that might causing the problem:
1) In my example I used val in place of var.lang
2) In my example I put a space between "if" and "[val]".

I think 2 is the culprit. I know for sure that [onload;when[...]] thing doesn't work but [onload;when [...]] does. So I think it's the missing space causing the trouble.
By: ege
Date: 2008-05-06
Time: 18:56

Re: Condizional display problem [val]

Ah, if that doesn't solve, put the space and try using == instead of =. I just remembered that someone recently complained about that as well.
By: pistacchio
Date: 2008-05-06
Time: 19:01

Re: Condizional display problem [val]

ehi!
thank you very much, the space solved the problem. should't it be pointed out to the authors? i mean, i don't think that a space should make any syntactical difference!

thank you very much indeed ^__^
By: ege
Date: 2008-05-06
Time: 19:08

Re: Condizional display problem [val]

Yes, I think it should. Skrol29, do you hear us? :) Once I have been going crazy trying to figure out why [..;when[...]] structure didn't work, struggled for about 20 mins until I copy an example from the site and checked both codes letter by letter. I think it should work without the space too.