View Full Version : Include and path to images

06-23-2010, 12:48 PM
I'm trying to convert an old site that is currently using frames to PHP.

The directory structure is the following:


In index.php I have the page item1.html included with 'include'. The page item1.html is displayed on the screen when included, but the images that should appear on it are not. The images associated to each itemX.html file are stored in an itemX subfolder of the articles folder. Is it possible to have images displayed without having to change the actual path in each html file? It's a pretty big site, over 400 pages, so I'm looking for minimum amount of changes needed. Thank you in advance!

06-23-2010, 01:03 PM
Would you be able to post the code for the pages you are using and the image paths?

It sounds like you need to look at the use of relative and absolute paths for the images.


06-23-2010, 01:57 PM
The code in index.php is something like this:

$id = $_GET["id"];
$cat = $_GET["cat"];

$path = '';

if ((!$id)||(!$cat)) {
$id = 'main';
$cat = 1;

switch ($cat) {
case 1: break;
case 2: $path = 'articles/';
case 3: $path = 'interviews/';
case 4: $path = 'photogallery/';
case 5: $path = 'reports/';
case 6: $path = 'archive/';



Let's say the requested page is 2010brian.html from the 'articles' folder. When displayed on the screen, the images show up as empty squares. The path seems to be 2010brian/image.jpg when in reality they are residing in articles/2010brian. I understand what is going on and why, I just need a way around it.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum