php include problem

php include problem

am 28.03.2007 23:42:09 von Pivi

Hi!

I have this files in my root folder

index.php
header.php
footer.php
"images" folder

then i made one new folder "new" and i copied index.php, header.php and
footer.php in this new folder (also leaving this files in root folder, too).

Now header.php and footer.php files in folder "new" are searching for images
in folder /new/images

and it shoud be looking for images in root folder/images

How can i fix this, so that all files in root folder and same files in new
folder retrieve images from the same location?

Thanks!

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: php include problem

am 29.03.2007 02:40:59 von bob plano

just use absolute URL's when you have the script include the pictures

On 3/28/07, Pivi wrote:
> Hi!
>
> I have this files in my root folder
>
> index.php
> header.php
> footer.php
> "images" folder
>
> then i made one new folder "new" and i copied index.php, header.php and
> footer.php in this new folder (also leaving this files in root folder, too).
>
> Now header.php and footer.php files in folder "new" are searching for images
> in folder /new/images
>
> and it shoud be looking for images in root folder/images
>
> How can i fix this, so that all files in root folder and same files in new
> folder retrieve images from the same location?
>
> Thanks!
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: php include problem

am 29.03.2007 02:45:40 von Hartleigh Burton

--Apple-Mail-8--746555154
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
delsp=yes;
format=flowed

When including try using ./new/images instead of /new/images

the . should tell it to start at root level.



On 29/03/2007, at 7:42 AM, Pivi wrote:

> Hi!
>
> I have this files in my root folder
>
> index.php
> header.php
> footer.php
> "images" folder
>
> then i made one new folder "new" and i copied index.php, header.php
> and
> footer.php in this new folder (also leaving this files in root
> folder, too).
>
> Now header.php and footer.php files in folder "new" are searching
> for images
> in folder /new/images
>
> and it shoud be looking for images in root folder/images
>
> How can i fix this, so that all files in root folder and same files
> in new
> folder retrieve images from the same location?
>
> Thanks!
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>





Regards,
Hartleigh Burton
Resident Geek

MRA Entertainment Pty Ltd
5 Dividend St | Mansfield | QLD 4122 | Australia
Phone: (07) 3457 5041
Fax: (07) 3349 8806
Mobile: 0421 646 978

www.mraentertainment.com



--Apple-Mail-8--746555154--

Re: php include problem

am 29.03.2007 03:32:24 von Niel Archer

Hi

> When including try using ./new/images instead of /new/images
>
> the . should tell it to start at root level.

No. the '.' tells it to start at current directory. '../' would tell it
to start at the parent directory (one level higher) so:

"../images/"
would work in this example.

bob's advice to use absolute paths would be safest though...

"www.your-domain.com/images/"



Niel

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: php include problem

am 29.03.2007 04:19:22 von Hartleigh Burton

--Apple-Mail-10--740932529
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
delsp=yes;
format=flowed

My bad ;)


On 29/03/2007, at 11:32 AM, Niel Archer wrote:

> Hi
>
>> When including try using ./new/images instead of /new/images
>>
>> the . should tell it to start at root level.
>
> No. the '.' tells it to start at current directory. '../' would
> tell it
> to start at the parent directory (one level higher) so:
>
> "../images/"
> would work in this example.
>
> bob's advice to use absolute paths would be safest though...
>
> "www.your-domain.com/images/"
>
>
>
> Niel
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>





Regards,
Hartleigh Burton
Resident Geek

MRA Entertainment Pty Ltd
5 Dividend St | Mansfield | QLD 4122 | Australia
Phone: (07) 3457 5041
Fax: (07) 3349 8806
Mobile: 0421 646 978

www.mraentertainment.com



--Apple-Mail-10--740932529--

RE: php include problem

am 29.03.2007 13:38:41 von Styve Couture

I do this little trick in the main file I include in all my php files. =
So after that, I only use the constants regardless how deep I am in a =
folder.

//pour trouver comment/ou inclure les fichiers peut importe =
l'emplacement du fichier appelant
if (!defined("SERVER_ROOT_PATH"))
{ =20
settype($str_pathUp, "string");
$str_pathUp =3D str_repeat("../", substr_count($_SERVER['PHP_SELF'], =
"/")-2); =20
//on construit le chemin des fichiers =20
DEFINE("SERVER_ROOT_PATH", $str_pathUp);
DEFINE("SERVER_FILE_PATH", SERVER_ROOT_PATH."fichier/");
DEFINE("SERVER_INCLUDEFILE_PATH", SERVER_ROOT_PATH."includeFiles/");
DEFINE("SERVER_IMAGE_PATH", SERVER_ROOT_PATH."image/");
DEFINE("SERVER_CSS_PATH", SERVER_ROOT_PATH."css/");
DEFINE("SERVER_TEMP_PATH", SERVER_ROOT_PATH."temp/");
DEFINE("SERVER_LOG_PATH", SERVER_ROOT_PATH."log/");
DEFINE("SERVER_CLASS_PATH", SERVER_ROOT_PATH."classe/");
DEFINE("SERVER_ADODB_CLASS_PATH", SERVER_CLASS_PATH."adodb/");
DEFINE("SERVER_MAIL_CLASS_PATH", SERVER_CLASS_PATH."mail/");
DEFINE("SERVER_NEWMAIL_CLASS_PATH", SERVER_CLASS_PATH."phpmailer/");
DEFINE("SERVER_ERROR_CLASS_PATH", SERVER_CLASS_PATH."errorHandler/");
DEFINE("SERVER_SESSION_CLASS_PATH", SERVER_CLASS_PATH."session/");
DEFINE("SERVER_SQL_CLASS_PATH", SERVER_CLASS_PATH."sqlWrapper/");
}
=09
// Fonctions g=E9n=E9rales n=E9cessaires =E0 certaines classes.
include_once(SERVER_INCLUDEFILE_PATH.'module_fonction_genera le.php');





-----Message d'origine-----
De=A0: Niel Archer [mailto:Niel Archer] De la part de Niel Archer
Envoyé : 28 mars 2007 21:32
À : php-windows@lists.php.net
Objet=A0: Re: [PHP-WIN] php include problem

Hi

> When including try using ./new/images instead of /new/images
>=20
> the . should tell it to start at root level.

No. the '.' tells it to start at current directory. '../' would tell it
to start at the parent directory (one level higher) so:

"../images/"
would work in this example.

bob's advice to use absolute paths would be safest though...

"www.your-domain.com/images/"



Niel

--=20
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: php include problem

am 31.03.2007 14:19:34 von Trystano

----------MB_8C941A5FA6A27F2_19E0_77A1_FWM-R05.sysops.aol.co m
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset="utf-8"

Yeah, thats the best way, to use a constant as you will only need to change=
it in one place if the location of the images need to change in the future.=
Also, I would'nt hard code your domain into the location path of the images=
as they won't work locally for testing (localhost). You probs best off usin=
g the variables that fall under $_SERVER for determining your application ro=
ot.
=20
Tryst
=20
-----Original Message-----
From: styve.couture@novo.ca
To: php-windows@lists.php.net
Sent: Thu, 29 Mar 2007 12.38PM
Subject: RE: [PHP-WIN] php include problem
=20
I do this little trick in the main file I include in all my php files. So=20=
after=20
that, I only use the constants regardless how deep I am in a folder.

//pour trouver comment/ou inclure les fichiers peut importe l'emplacement du=
=20
fichier appelant
if (!defined("SERVER_ROOT_PATH"))
{ =20
settype($str_pathUp, "string");
$str_pathUp =3D str_repeat("../", substr_count($_SERVER['PHP_SELF'],=
=20
"/")-2); =20
//on construit le chemin des fichiers =20
DEFINE("SERVER_ROOT_PATH", $str_pathUp);
DEFINE("SERVER_FILE_PATH", SERVER_ROOT_PATH."fichier/");
DEFINE("SERVER_INCLUDEFILE_PATH", SERVER_ROOT_PATH."includeFiles/");
DEFINE("SERVER_IMAGE_PATH", SERVER_ROOT_PATH."image/");
DEFINE("SERVER_CSS_PATH", SERVER_ROOT_PATH."css/");
DEFINE("SERVER_TEMP_PATH", SERVER_ROOT_PATH."temp/");
DEFINE("SERVER_LOG_PATH", SERVER_ROOT_PATH."log/");
DEFINE("SERVER_CLASS_PATH", SERVER_ROOT_PATH."classe/");
DEFINE("SERVER_ADODB_CLASS_PATH", SERVER_CLASS_PATH."adodb/");
DEFINE("SERVER_MAIL_CLASS_PATH", SERVER_CLASS_PATH."mail/");
DEFINE("SERVER_NEWMAIL_CLASS_PATH", SERVER_CLASS_PATH."phpmailer/");
DEFINE("SERVER_ERROR_CLASS_PATH", SERVER_CLASS_PATH."errorHandler/")=
;
DEFINE("SERVER_SESSION_CLASS_PATH", SERVER_CLASS_PATH."session/");
DEFINE("SERVER_SQL_CLASS_PATH", SERVER_CLASS_PATH."sqlWrapper/");
}
=20
// Fonctions générales nécessaires à certaines class=
es.
include_once(SERVER_INCLUDEFILE_PATH.'module_fonction_genera le.php');





-----Message d'origine-----
De : Niel Archer [mailto:Niel Archer] De la part de Niel Archer
Envoyé : 28 mars 2007 21:32
À : php-windows@lists.php.net
Objet : Re: [PHP-WIN] php include problem

Hi

> When including try using ./new/images instead of /new/images
>=20
> the . should tell it to start at root level.

No. the '.' tells it to start at current directory. '../' would tell it
to start at the parent directory (one level higher) so:

"../images/"
would work in this example.

bob's advice to use absolute paths would be safest though...

"www.your-domain.com/images/"



Niel

--=20
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--=20
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
=20

----------MB_8C941A5FA6A27F2_19E0_77A1_FWM-R05.sysops.aol.co m--