Kyle Hamilton
asked on
add additional url to existing script
I have a script that displays a "DEMO" image in the header of every page but the home page. I would like to add another page (url) where the "DEMO" image doesn't show (i.e. the DEMO page). It's probably very simple, I just don't know the syntax (it's not my script).
FYI, this is the part of the script that determines the page that does NOT show the image:
if(curPageURL() == 'http://www.realwalkthru.com/testing/')
Thanks,
Kyle
FYI, this is the part of the script that determines the page that does NOT show the image:
if(curPageURL() == 'http://www.realwalkthru.com/testing/')
Thanks,
Kyle
<?php
function curPageURL() {
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
return $pageURL;
}
if(curPageURL() == 'http://www.realwalkthru.com/testing/')
print '<div id="logoDemo">
<div id="logo" class="fllft"><a href="http://www.realwalkthru.com/testing/"><img src="http://www.realwalkthru.com/testing/images/home/logo.jpg" border="0"/></a></div></div>';
else
print
'<div id="logoDemo">
<div id="logo" class="fllft"><a href="http://www.realwalkthru.com/testing/"><img src="http://www.realwalkthru.com/testing/images/home/logo.jpg" border="0"/></a></div><div class="flrgt"><a href="demo.php"><img src="http://www.realwalkthru.com/testing/images/home/demoButt.gif" border="0" style="padding:45px 20px 0px 0px;"></a></div></div>';
?>
ASKER
Thanks for the response, but that's not going to help.
Sorry I didn't explain this better.
The header is an include file which is used on every page of the site. The reason I have the PHP script in there in the first place is so that I don't have to use a separate header file for the home page (for example, if I make a change to the menus, I won't have to make it twice). At the moment the home page is the only page that does not have the "demo" button in the header. That's what the script does.
What I want to achieve is to add another page (i.e. the "demo" page), to the script, so it too, won't display the "demo" button in the header.
It's probably something like writing an array of urls, but I don't know how to do it.
Cheers
Sorry I didn't explain this better.
The header is an include file which is used on every page of the site. The reason I have the PHP script in there in the first place is so that I don't have to use a separate header file for the home page (for example, if I make a change to the menus, I won't have to make it twice). At the moment the home page is the only page that does not have the "demo" button in the header. That's what the script does.
What I want to achieve is to add another page (i.e. the "demo" page), to the script, so it too, won't display the "demo" button in the header.
It's probably something like writing an array of urls, but I don't know how to do it.
Cheers
$urlset = array('http://www.realwalkthru.com/testing/', 'someotherurl','andanotherurl');
function inArray( $url) {
foreach ($urlset as $value) {
if ($url = $value) return true;
}
return false;
}
if(inArray(curPageURL()) == true)
ASKER
That's exactly what I'm looking for! cheers.
One glitch though... I'm getting this error:
Warning: Invalid argument supplied for foreach()
One glitch though... I'm getting this error:
Warning: Invalid argument supplied for foreach()
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
You're special. Thank you so much!
Open in new window