473,508 Members | 4,628 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

include problem

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
4 3180
"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
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
"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

"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
2975
by: Yannick Turgeon | last post by:
Oups! I did a typing error in my last post. Fixed. ----------- Hello all, We are currently changing our web server and, in the process, updating PHP version from 4.3.0 to 4.3.5. The problem...
43
5042
by: steve | last post by:
I am quite frustrated with php’s include, as I have spent a ton of time on it already... anyone can tell me why it was designed like this (or something I don’t get)? The path in include is...
6
7050
by: alan | last post by:
Dear all, I have written my own function by C. And my development platform is W2k with VC6.0. Then I also defined a header file to extern declare this function. After that, I include this...
6
9564
by: atv | last post by:
Alright, i have some questions concerning include files en global variables.I hope someone is willing to answer these. 1).Why is it that if i define a global variable in a file, say main.c, and...
60
8210
by: Derrick Coetzee | last post by:
It seems like, in every C source file I've ever seen, there has been a very definite include order, as follows: - include system headers - include application headers - include the header...
5
2495
by: David Mathog | last post by:
One thing that can make porting C code from one platform to another miserable is #include. In particular, the need to either place the path to an included file within the #include statement or to...
0
1195
by: Francois | last post by:
Hi, I think I found a bug with VS, and I've included a project example of the problem I got. I've got a project deep into a set of folders. The project have an additional include library...
3
2690
by: Arpi Jakab | last post by:
I have a main project that depends on projects A and B. The main project's additional include directories list is: ...\ProjectA\Dist\Include ...\ProjectB\Dist\Include Each of the include...
6
2093
by: tshad | last post by:
In my User control, I tried to do this: *************************************************************************** <Script runat="server"> Public ClientName As String = "<!-- #include file =...
5
2205
by: Tio | last post by:
I have project in MFC(vc++) . There are files and classes: classes:dialog1,dialog2,aaa,bbb ---------------------- main.cpp --------------------- #include "mainfrm.h" #include "dialog1.h"...
0
7228
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7393
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7058
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7502
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5635
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4715
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3206
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3191
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
769
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.