473,408 Members | 1,623 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,408 software developers and data experts.

How to acces the same dir from different dirs..

Hi - I cant fins the right way to put this problem..

I have a structore wich is like this..

www.thewebsite.dk/images/

And from a dir

http://www.thewebsite.dk/something/s...gelse/test.php
and
www.thewebsite.dk/something/test.php

i like to include the same image pic.jpg, with the same code but i cant get
it to work..

I have tried.. include("/images/pic.jpg"); and the below but none work..

/images/pic.jpg
images/pic.jpg
//images/pic.jpg
\images\pic.jpg
images\pic.jpg
\\images\pic.jpg

What am i doing wrong..

Best regards

Timo.
Jul 17 '05 #1
6 1624
Timo J wrote:
Hi - I cant fins the right way to put this problem..

I have a structore wich is like this..

www.thewebsite.dk/images/

And from a dir

http://www.thewebsite.dk/something/s...gelse/test.php
try:

include '../../images/pic.jpg';

from here.
.../ means 'up one directory'
and
www.thewebsite.dk/something/test.php
try:

include '../images/pic.jpg';


i like to include the same image pic.jpg, with the same code but i cant
get it to work..

I have tried.. include("/images/pic.jpg"); and the below but none work..

/images/pic.jpg
images/pic.jpg
//images/pic.jpg
\images\pic.jpg
images\pic.jpg
\\images\pic.jpg

What am i doing wrong..

Best regards

Timo.

Regards,
Erwin Moller
Jul 17 '05 #2
Yep thats will do the trick - but i where hoping that there where some
syntax so that i where able of useing the same code manny places without
changing it..

But thanks anyway

Timo

"Erwin Moller"
<si******************************************@spam yourself.com> skrev i en
meddelelse news:40*********************@news.xs4all.nl...
Timo J wrote:
Hi - I cant fins the right way to put this problem..

I have a structore wich is like this..

www.thewebsite.dk/images/

And from a dir

http://www.thewebsite.dk/something/s...gelse/test.php


try:

include '../../images/pic.jpg';

from here.
../ means 'up one directory'
and
www.thewebsite.dk/something/test.php


try:

include '../images/pic.jpg';


i like to include the same image pic.jpg, with the same code but i cant
get it to work..

I have tried.. include("/images/pic.jpg"); and the below but none work..

/images/pic.jpg
images/pic.jpg
//images/pic.jpg
\images\pic.jpg
images\pic.jpg
\\images\pic.jpg

What am i doing wrong..

Best regards

Timo.

Regards,
Erwin Moller

Jul 17 '05 #3
"Timo J" <Ti**********@s-d-i.dk> wrote:
I have a structore wich is like this..

www.thewebsite.dk/images/

And from a dir

http://www.thewebsite.dk/something/s...gelse/test.php
and
www.thewebsite.dk/something/test.php

i like to include the same image pic.jpg, with the same code but i
cant get it to work..

I have tried.. include("/images/pic.jpg"); and the below but none
work..


Hi Timo,

include() doesn't expect a URL (unless prepended by http/ftp. etc.) but a
system path. So use the full system path, e.g.:

include("/www/docroot/images/pic.jpg");

HTH;
JOn
Jul 17 '05 #4
Timo J wrote:
Yep thats will do the trick - but i where hoping that there where some
syntax so that i where able of useing the same code manny places without
changing it..


In that situation a complete URI will do the trick.

use:

<img src="http://www.thewebsite.dk/images/pic.jpg">

which will always point to the right location.
Because imageloading is done by the browser, I expect it to be as fast as
.../../etc. notation.
Except when your browser does a namelookup every time, which I hope it
doesn't. :P

Regards,
Erwin Moller
Jul 17 '05 #5
On Tue, 27 Jan 2004 13:24:36 +0100, Timo J wrote:
Yep thats will do the trick - but i where hoping that there where some
syntax so that i where able of useing the same code manny places without
changing it..

But thanks anyway

try using server constant DOCUMENT_ROOT if relative addressing doesnt work
for you

example

$homedir = $_SERVER["DOCUMENT_ROOT"].$mydir;
Jul 17 '05 #6

"Krečo Kunjas" <de****@gamebox.net> skrev i en meddelelse
news:sg***************************@40tude.net...
On Tue, 27 Jan 2004 13:24:36 +0100, Timo J wrote:
Yep thats will do the trick - but i where hoping that there where some
syntax so that i where able of useing the same code manny places without
changing it..

But thanks anyway

try using server constant DOCUMENT_ROOT if relative addressing doesnt work
for you

example

$homedir = $_SERVER["DOCUMENT_ROOT"].$mydir;


Perfect.... just the rigth stuff!

Thanks All !

Timo.

Jul 17 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: George Hester | last post by:
If I have 1 Virtual Dirctory with 2 different subfolders are these 2 different folders different virtual folders? Or if I have 2 different Virtual Directories each containing a subfolder are these...
2
by: SzokU | last post by:
Does javascript have acces to source code of previous page when I open a page from the same domain with window.open("new_page_with_script","_self","");? window.opener.document.innerHTML doesn't...
1
by: TTD_hck | last post by:
Hello, I need suggestions for the following. I have a acces 97 database and with a script command in acces 97, I can e-mail a file via outllok. I do this with the folowing command in Acces 97:...
0
by: John Smith | last post by:
I am currently using excel to manage a small database. The problem is my database is getting big and I need more then the 65000 lines excel can have. I have considered access but it lacks some...
2
by: Arjen | last post by:
Hello, Let's see this sample code. Here is the main. <cut> namespace A { /// <summary> /// Singleton /// </summary>
6
by: rtilley | last post by:
Hello, When working with file and dir info recursively on Windows XP. I'm going about it like this: for root, dirs, files in os.walk(path): for f in files: ADD F to dictionary for d in...
6
by: Ron M. Newman | last post by:
Hi, Under what circumstances can I ever get an exception about not being able to cast type "ABC" to type "ABC" if there's only one ABC class in the system and it's loaded from a dynamic...
2
by: Evan Carmi | last post by:
hi, i am creating a program to go through a directory structure recursively (including directories below it) and move all files that end in .msf to a directory above the current level. the...
8
by: J. Frank Parnell | last post by:
Hi there, I got this directory tree listing function somewhere, it works great, but I want it to only list directories that do have one or more .jpgs inside. I tried getting a list of each dir's...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.