Jump to content
Sign in to follow this  

STS Template help - login / logout button

Recommended Posts



I've been trying something out with STS 1.8.


Basically my site: nettik.co.uk is all going great, apart from one thing. on the menu bar, I am trying to add a button that will detect whether you are logged in or logged out; and then display the according relevant button. Eg user is logged in, menu item is "log off" which points to 'logoff.php' file.


I started by renaming the sts_template.html file to sts_template.php to give me some dynamic functionality, and then updated configure.php accordingly.


I then made a quick IF statement to display a text link depending on their statement:


$sessionid = $HTTP_GET_VARS['osCsid'];

if ( $sessionid == "" ) {
echo('<a href="login.php">login</a>');
} else {
echo('<a href="logoff.php">logout</a>');


and added this code in one of the table cells where the images would eventually sit once the code was sorted.


However, when you look at the page live, instead of a text link, you get elements of the PHP code printed out !! ??


Also, i don't think the code is working either, because even when you're logged off, and the intro text says: "welcome! You're currently a Guest!" the result of the IF statement above outputs the 'logoff.php' option of the statement.


Any help would be greatly appreciated.


I have also insterted a link here to a downloadable version of my STS template.


Thx in advance, really need help !



Share this post

Link to post
Share on other sites



You can't use PHP in the STS template file; it doesn't get read that way. If you want to do something like that, you would be better off with the BTS or just editing the files without a template system. In this case though, I don't think that you need to put the code there. Just make a new box that holds the link that you want and put the code in the box. I suspect that you can find an example of this in the main STS support thread.




Always back up before making changes.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this