By: srabutdotcom
Date: 2013-02-13
Time: 05:36
|
php code behaviour in sub template
Dear All,
I have a situation where php code on subtemplate doesn't work. The story is that i have a link like ./?act=logout in main template.
and having php code like... "if(isset($_GET['act']) {.....bla bla..." in subtemplate.
but that php code in sub template is not work at all, except i put that code on main php file which is index.php.
Can anyone give me a further explanation?
rgds
|
By: Skrol29
Date: 2013-02-14
Time: 23:59
|
Re: php code behaviour in sub template
Hi,
The variable $_GET is global and should be available in the sub-template script.
We need more elements or mode debug clues in order to help.
For example, did you try to test $_GET['act'] in the sub-template and have the result back on the main template ?
|
By: srabutdotcom
Date: 2013-02-15
Time: 10:48
|
Re: php code behaviour in sub template
Hi,
this is the code:
Index.php
$TBS = new clsTinyButStrong;
$TBS->LoadTemplate('main.html')
$TBS->show()
|
main.html
<div>
<a href="./act=logout"> logout </a>
</div>
<div>
[onload;script=logged.php;subtpl]
</div>
|
logged.php
if ($_GET['act'] == "logout") {
$_SESSION['name'] = "GUEST";
}
|
|
By: Skrol29
Date: 2013-02-16
Time: 23:10
|
Re: php code behaviour in sub template
And how can you see it is not working ?
|
By: srabutdotcom
Date: 2013-02-17
Time: 16:04
|
Re: php code behaviour in sub template
sorry the main.html is like this
<div>[onload;block=div;when [var._SESSION.level]!='GUEST']
<a id="headermenu" href="./?act=logout">Logout</a>
</div>
<div>
[onload;script=logged.php;subtpl]
</div>
|
when i click the logout link, the logout menu still exist where it should be dissapear as per onload rule
|
By: Skrol29
Date: 2013-02-18
Time: 11:03
|
Re: php code behaviour in sub template
Hi,
First of all, your script did not mention a call to session_stat(). I assume you have it somewhere anyway.
You problem is probably that the conditional section (when [var._SESSION.level]...) is placed before the sub-template field ([onload;script=logged.php;subtpl]).
Therefore, when the conditional section is processed, the sub-script has never be called yet.
|
|
Posting in progress.
Please wait...
|