Categories > TinyButStrong general >

Login/Logout repost

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Ed
Date: 2005-10-28
Time: 23:46

Login/Logout repost

Sorry, i forgot to use

Hi Skrol,  just starting to set up my website using TBS and appreciate your suggestion on these:

SITUATION:
1. Login box (with fields username, password, remember me, sign up) resides in a separate template. Lets call this template, "left_side_of_page.htm". This template has other components other than the login box.

2. Logout box (with fields logout, my account) also resides in another template. lets call this template "page_header.htm". Also, this template has other components other than the logout box.


3. "left_side_of_page.htm" and "page_header.htm" are used as subtemplates only.

DESIRED ACTION:
When a user is already logged in, he cannot see the Login box (at "left_side_of_page.htm" subtemplate) on any page but can access the Logout box (at "page_header.htm" subtemplate). In the same manner, if he's not logged in yet the Logout box is inaccesible while the Login box accesible.



MAIN TEMPLATE ("main_template.htm") :
<body>

[onload;file='templates/page_header.htm']

[onload;file=[var.tmpl_menu]]

[onload;file=[var.tmpl_maincontent]]

[onload;file='templates/footer.htm']

</body>


PHP:
<?php
include_once('include/tbs_class_php5.php');
$TBS = new clsTinyButStrong();
.
.
.
$tmpl_menu='templates/left_side_of_page.htm';
$tmpl_maincontent='templates/regmember.htm';
.
.
$TBS->LoadTemplate('templates/main_template.htm');
$TBS->Show();
?>

MY QUESTION IS:
How do i set up the Logout form at "page_header.htm" and Login form at "left_side_of_page.htm" to get the desired action. Please note that "page_header.htm" is constant in "main_template.htm" while "left_side_of_page.htm" is called by [var.tmpl_menu], and loaded as "$tmpl_menu='templates/left_side_of_page.htm'" in PHP.

Thanks a lot.

By: Skrol29
Date: 2005-10-31
Time: 01:07

Re: Login/Logout repost

Hello Ed,

The simpliest way is to use [onload] conditional blocks in the subtemplates.

<div>
  [onload_login;block=div;when [var.logged]=0]
  LOGIN DISPLAY
</div>

<div>
  [onload_logout;block=div;when [var.logged]=1]
  LOGOUT DISPLAY
</div>

By: Ed
Date: 2005-10-31
Time: 02:21

Re: Login/Logout repost

Many thanks Skrol, now i have something to start,i will try this approach.