I have a simple div which I don’t want to load if the visitor loads up a certain URL.
It looks like this:
<?php
if( stristr($_SERVER['PHP_SELF'], 'blog') == FALSE )
{
echo "<div id="stuff"></div>";
}
?>
Problem is… it doesn’t work… when I load up http://www.url.com/blog the div#stuff still shows.
Am I just lacking sleep or should the above work? What would you do to not have a div display if the url contains blog ?
Try
$_SERVER['REQUEST_URI']instead:REQUEST_URIcontains the requested URI path and query and not just the filename of the currently executing script likePHP_SELFdoes.