richm Posted February 4, 2004 Share Posted February 4, 2004 Hiya! 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: <?php $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 ! Rich Quote Link to comment Share on other sites More sharing options...
♥ecartz Posted February 4, 2004 Share Posted February 4, 2004 Hello, 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. Hth, Matt Quote Always back up before making changes. Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.