Guest Posted November 14, 2005 Share Posted November 14, 2005 I am attempting to create a conditional index.php page that will show different content depending on if an unregistered user visits the site or someone logs in. I've started with a conditional statement just to see if I can validate the condition and show text. I am currently working in the english/index.php file and this doesn't seem to work: <?php if (!tep_session_is_registered('customer_id')) { define('TEXT_MAIN','Registered'); } else { define('TEXT_MAIN','Guest'); } ?> Ultimately, I would like to show completely different TEXT_MAIN for guests and registered users. Any direction on this would be greatly appreciated. Link to comment Share on other sites More sharing options...
Jack_mcs Posted November 15, 2005 Share Posted November 15, 2005 You should do the condition testing in the index.php file. Jack Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
Guest Posted November 15, 2005 Share Posted November 15, 2005 Excellent. It works based on your recommendation. I do have one quick follow up. I am attempting to generate conditional HTML with PHP functions embedded. If I just put the HTML I am working with in the default page area it works but if I put echo 'HTML here'; it breaks Is there any specific formating I need to include in an echo statement or should I be using a completely different kind of statement? Is there a best practice for using conditional HTML with PHP functions embedded in it? Thanks for your help! Link to comment Share on other sites More sharing options...
Jack_mcs Posted November 15, 2005 Share Posted November 15, 2005 It's usually handled the other way around. Enlose the php code with php delimiters and add the html code normally. Something like <tr> <td> <?php echo 'Some text'; ?> </td> </tr> Jack Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.