Hello,
I have a simple website with five or six pages of which have a different header image. I’m trying to create the code to check the page’s URL and match it with the correct header image. This is the code I’m trying to use, but can’t figure out why it won’t work. I am calling this code by ‘include’ on each page:
[php]<?php
// List of page images to their root page.
$image_item = array(
“/images/home_banner.jpg” => “/home.php”,
“/images/home_banner.png” => “/energy.php”,
“/images/home_banner.png” => “/capital.php”,
“/images/technologies_banner.jpg” => “/technologies.php”,
“/images/home_banner.png” => “/properties.php”,
“/images/home_banner.png” => “/contact.php”,
);
$currenturl = $_SERVER[‘PHP_SELF’];
$currentimage = array_search($currenturl, $image_item);
echo ’
?>[/php]
More than likely there’s something I’m missing. Any help would be greatly appreciated.