kade119 Posted January 19, 2010 Share Posted January 19, 2010 I'm a noob, looking for help w/ a small code snippet what i'm trying to do is show content based on if the url is at the root or at index.php otherwise it hides the content so if i'm at the index or root it will show my content/html otherwise any other URL it should be hidden thanks Link to comment https://forums.phpfreaks.com/topic/189041-php-if-else-statement/ Share on other sites More sharing options...
Buddski Posted January 19, 2010 Share Posted January 19, 2010 if (!strstr($_SERVER['SCRIPT_NAME'],'index.php')) { // Hide content // } else { // Show content // } Link to comment https://forums.phpfreaks.com/topic/189041-php-if-else-statement/#findComment-998141 Share on other sites More sharing options...
kade119 Posted January 19, 2010 Author Share Posted January 19, 2010 so it would look like this? is that the correct script? <?php if (!strstr($_SERVER['REQUEST_URI'],'index.php')) { // Hide content // } else { // Show content // (' my html here '); Link to comment https://forums.phpfreaks.com/topic/189041-php-if-else-statement/#findComment-998180 Share on other sites More sharing options...
Buddski Posted January 20, 2010 Share Posted January 20, 2010 Basically yeah.. You would need to echo it tho.. echo "my html"; Link to comment https://forums.phpfreaks.com/topic/189041-php-if-else-statement/#findComment-998433 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.