
I have a function that displays the footer on the web pages that uses an image reference. To reference the location of the directory I have created a variable called $
image_path that holds the directory location of the images. My code looks like this:
Code:
$image_path="http://127.0.0.1/testsite/images";
function footer()
{
global $image_path;
echo "<img src=\"$image_path/footer.gif\" alt=\"#\" name=\"footerImage\" width=\"11\" height=\"14\" border=\"0\" id=\"footerImage\">";
}
I several different footers for different sections of the website.
When I come to call the function it displays it without any problem, but I get the error message:
Fatal error: Cannot redeclare footer() (previously declared in C:\Progra~1\Apache Group\Apache2\htdocs\testsite\includes\common\inc_ common.php:11) in C:\Progra~1\Apache Group\Apache2\htdocs\testsite\includes\common\inc_ common.php on line 9
I have had a look through the PHP books and it looks like that I am doing the right thing in calling the variable and declaring it as global within the function.
Am I doing it wrong?
Thanks.
Michael.