Include in php.

galaxyAbstractor

Community Advocate
Community Support
Messages
5,508
Reaction score
35
Points
48
I tried to use:

PHP:
<?php
include($_SERVER['DOCUMENT_ROOT']."/ufo/includes/bannertop.html");
?>

to include an image because I may change that image someday and I am lazy to edit all files then so I decided to have an include to a document the image is in. The bannertop.html has:

HTML:
<img src="../images/ufo.png" alt="UFO - ARCHIVE" width="468" height="60" longdesc="http://ufo.jagf.net">

What have I done wrong?

My fault, dreamweaver added wrong path...
 
Last edited:

Mitch

New Member
Messages
908
Reaction score
0
Points
0
Try this.
Code:
<?php
$root = $_SERVER['DOCUMENT_ROOT'];
include ($root."/ufo/includes/bannertop.html");
?>
 

diabolo

Community Advocate
Community Support
Messages
1,682
Reaction score
32
Points
48
PHP:
<?php
include($_SERVER['DOCUMENT_ROOT'] . "/ufo/includes/bannertop.php");
?>

I would change bannertop.html to php:

PHP:
echo "<img src=\"$_SERVER['DOCUMENT_ROOT'] . '/ufo/images/ufo.png\" alt=\"UFO - ARCHIVE\" width=\"468\" height=\"60\" longdesc=\"http://ufo.jagf.net\">";
 
Top