Categories > TinyButStrong general >

if-condition in external loaded template

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: neverpanic
Date: 2005-10-08
Time: 00:11

if-condition in external loaded template

<!-- [onload_1;block=div;when [var.boolDisplayNav]=1;comm] -->
fails for me in a loaded template
(using <!-- [onload;file='file.htm';comm;htmlconv=no] -->), although I can display the var value in the loaded file with [var.boolDisplayNav] (returns 1).

I did decare this variables using the superglobal $GLOBALS array:
$GLOBALS['boolDisplayNav'] = 1;


h  e  l  p  !
By: Skrol29
Date: 2005-10-09
Time: 14:59

Re: if-condition in external loaded template

Hello,

It should work :(
Do you have any error message ?
Wjhat do you have in the template at the block place ?
By: neverpanic
Date: 2005-10-09
Time: 15:04

Re: if-condition in external loaded template

Error:
TinyButStrong Error (Merge PHP global variables): Can't merge [var.boolLoginLogin] because there is no PHP global variable named 'boolLoginLogin'. This message can be cancelled using parameter 'noerr'.

and here a part of my source, just as example:
<div id="login">
        <!-- [onload;block=div;when [var.boolLoginLogin]=1;comm] -->
        <h1>logIn</h1>
        <form id="form1" method="post" action="login.php">
            <table style="width:80%; text-align:center;">
                <tr>
                    <td>userName</td>
                    <td>
                        <input name="userName" type="text" id="userName" size="6" />
                    </td>
                </tr>
                <tr>
                    <td>passWort</td>
                    <td>
                        <input name="passWort" type="password" id="passWort" size="6" />
                    </td>
                </tr>
            </table>
            <p class="center">
                <input type="submit" name="Submit" value="logIn" />
                <input type="button" name="Submit" value="registrieren" onClick="location='/old/xtrazone.register.php'" />
            </p>
        </form>
    </div>
By: Skrol29
Date: 2005-10-10
Time: 11:50

Re: if-condition in external loaded template

Thta is probably because the global variable $boolLoginLogin is not set yet when you call LoadTemplate().
By: neverpanic
Date: 2005-10-10
Time: 16:57

Re: if-condition in external loaded template

So the variables need to be set before loading the template?
Well, how should I know this? I'll try...
By: Skrol29
Date: 2005-10-10
Time: 17:16

Re: if-condition in external loaded template

Not exaclty.
A variable needs to be set when TBS needs it for merging.
Variables embedded into [onload] tags are needed on the LoadTemplate() call. Other variables are usually needed on the Show() call.
By: neverpanic
Date: 2005-10-10
Time: 17:52

Re: if-condition in external loaded template

So I could have used onshow and it should have worked, too?
Doesn't matter, it works with $tbs->LoadTemplate(); moved to the end of my php file, thanks.
By: Skrol29
Date: 2005-10-10
Time: 17:57

Re: if-condition in external loaded template

Yes it should have worked.
By: neverpanic
Date: 2005-10-10
Time: 18:04

Re: if-condition in external loaded template

well, thanks for your quick help, and sorry for my newbie-behavoiur ;-)