Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-23-2010, 11:48 AM   PM User | #1
weirdvision
New to the CF scene

 
Join Date: Jun 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
weirdvision is an unknown quantity at this point
Include and path to images

I'm trying to convert an old site that is currently using frames to PHP.

The directory structure is the following:

/articles
/articles/item1
/articles/item1.html
/articles.html
/index.php

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!
weirdvision is offline   Reply With Quote
Old 06-23-2010, 12:03 PM   PM User | #2
ahayzen
Regular Coder

 
ahayzen's Avatar
 
Join Date: Jun 2009
Posts: 110
Thanks: 8
Thanked 11 Times in 11 Posts
ahayzen is an unknown quantity at this point
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.

Andy
ahayzen is offline   Reply With Quote
Old 06-23-2010, 12:57 PM   PM User | #3
weirdvision
New to the CF scene

 
Join Date: Jun 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
weirdvision is an unknown quantity at this point
The code in index.php is something like this:

PHP Code:
$id $_GET["id"];
$cat $_GET["cat"];

$path '';

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

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

include(
"left.html");

include(
$path.$id.'.html'); 
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.
weirdvision is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:30 PM.


Advertisement
Log in to turn off these ads.