473,396 Members | 1,777 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 3173
"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
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
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
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
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
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
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
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
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
by: tshad | last post by:
In my User control, I tried to do this: *************************************************************************** <Script runat="server"> Public ClientName As String = "<!-- #include file =...
5
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
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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...

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.