Help me with this php "(:(:(

jr D.I.P

BANNED
Joined
Jan 31, 2012
Messages
690
Reaction score
377
<?php if ( "M ON THIS IS URL" ) : ?>


then content here


<?php endif; ?>


how to "??
 
Lets say you are on:
http://yoursite.com/index.php?page=here

if($_GET['page'] == 'here'){
echo "IM HERE";
}else{
echo "this will be shown if the page isnt here";
}
 
You can use query strings, cookies, or other means of tracking state. I recommend you learn how to make an if statement and the basics before learning this.
 
Just replace the example URLs with the correct URLs and this will work:

Code:
<?php
    $url = 'your full url here';
    $getCurrentUrl = $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
    if (strstr($fullUrl, 'your full url here')):
?>
    Place page content here.
<?php else: ?>
    Other content here.
<?php endif; ?>
?>

If you just want to use what comes after the domain name, use only $_SERVER['REQUEST_URI'] as shown below:

Code:
<?php
    $url = 'your full URL here';
    $afterUrl = $_SERVER['REQUEST_URI'];
    if (strstr($afterUrl, 'your partial url here')):
?>
    Place page content here.
<?php else: ?>
    Other content here.
<?php endif; ?>
?>
 
Last edited:
Are you kidding ?! cookiess for determining the page url?:rocketwho
You can use query strings, cookies, or other means of tracking state. I recommend you learn how to make an if statement and the basics before learning this.
 
Back
Top