By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,729 Members | 1,363 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,729 IT Pros & Developers. It's quick & easy.

include problem

P: n/a
i have a page that INCLUDES another page but when the second page is
included all the images are not showing.

it is because the image url's are relative not absolute so the page is
looking for the images relative to the main page location not the include
page location - i dont want to have to change all the url's for the images -
is there a way around this

thanks in advance

Jul 17 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
"chris" <so*****@here.com> wrote in message
news:3f********@funnel.arach.net.au...
i have a page that INCLUDES another page but when the second page is
included all the images are not showing.

it is because the image url's are relative not absolute so the page is
looking for the images relative to the main page location not the include
page location - i dont want to have to change all the url's for the images - is there a way around this

thanks in advance

You answered your own question.
The image paths must be relative to the script that is trying to display
them.

and DONT cross post.

Regards
Richard Grove

http://shopbuilder.org - ecommerce systems
Become a Shop Builder re-seller:
http://www.affiliatewindow.com/affil...ls.php?mid=611
http://www.affiliatewindow.com/a.pl?590


Jul 17 '05 #2

P: n/a
chris wrote:

i have a page that INCLUDES another page but when the second page is
included all the images are not showing.

it is because the image url's are relative not absolute so the page is
looking for the images relative to the main page location not the include
page location - i dont want to have to change all the url's for the images -
is there a way around this

thanks in advance


You may be able to use the <BASE HREF=""> html tag. But that would probably
screw up the links and images on your first page.

Or you may be able to use preg_replace to change the image SRC values. That may
work well if you have consistent syntax in your html.

Regards,
Shawn
--
Shawn Wilson
sh***@glassgiant.com
http://www.glassgiant.com
Jul 17 '05 #3

P: n/a
"chris" <so*****@here.com> schrieb im Newsbeitrag
news:3f********@funnel.arach.net.au...
i have a page that INCLUDES another page but when the second page is
included all the images are not showing.

it is because the image url's are relative not absolute so the page is
looking for the images relative to the main page location not the include
page location - i dont want to have to change all the url's for the images - is there a way around this

thanks in advance


If the included page contains the whole HTML page as in:

if(isset($_POST['something'])) {
do something;
include("otherpage.php");
exit;
}
else {
display page;
}

you could easily use

header("Location: otherpage.php");

instead of the include command. Like that the url of the page you display
corresponds to the actual place where the file is stored, so you don't have
a relative path problem.

HTH
Markus
Jul 17 '05 #4

P: n/a

"Shawn Wilson" <sh***@glassgiant.com> wrote in message
news:3F***************@glassgiant.com...
chris wrote:

i have a page that INCLUDES another page but when the second page is
included all the images are not showing.

it is because the image url's are relative not absolute so the page is
looking for the images relative to the main page location not the include page location - i dont want to have to change all the url's for the images - is there a way around this

thanks in advance
You may be able to use the <BASE HREF=""> html tag. But that would

probably screw up the links and images on your first page.
Thanks that worked i just did this and it worked great thanks

<BASE HREF="relative link for the include file">
<?php include("include file") ?>
<BASE HREF="relative link for the main file">


Or you may be able to use preg_replace to change the image SRC values. That may work well if you have consistent syntax in your html.

Regards,
Shawn
--
Shawn Wilson
sh***@glassgiant.com
http://www.glassgiant.com

Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.