Probleme de chemin de fichiers avec les includes

Petit nouveau ! | 7 Messages

28 janv. 2009, 17:42

Bonjour,

J'ai un probleme :
Mes fichiers haut.php, navgauche.php sont à la racine de mon site.
Lorsque je fais appel à eux (par la fonction includes) dans un fichier qui lui n'est pas à la racine, les images ne s'affichent pas.
Comment faire pour résoudre ce probleme de chemin ?

Administrateur PHPfrance
Administrateur PHPfrance | 11457 Messages

28 janv. 2009, 18:48

Commencer par nous montrer le code incriminé ?... :-*

Invité
Invité n'ayant pas de compte PHPfrance

28 janv. 2009, 19:10

En fait ça ne va pas beaucoup vous aider mais bon...


Voila le code de mon index

Code : Tout sélectionner

<div class="haut" > <?php include('haut.php'); ?></div> <table width="976" height="100%" border="0" align="center" valign="top" cellpadding="0" cellspacing="0"> <tr> <td width="38" valign="top" background="images/fond_body_nav_g.gif"><img src="http://www.ville-joeuf.fr/v2/images/body_g.jpg" width="38" height="401" hspace="0" vspace="0"></td> <td width="148" valign="top" bgcolor="#C9D8DD"><div class="navgauche" height="100%"> <?php include('navgauche.php'); ?></div></td> <td width="604" height="100%" valign="top" bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td><img src="images/pix_trans.gif" width="604" height="9" hspace="0" vspace="0" border="0"></td> </tr> <tr> <td bgcolor="#CCCCCC"><img src="images/pix_trans.gif" width="604" height="1" hspace="0" vspace="0" border="0"></td> </tr> </table> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td>&nbsp;</td> </tr> </table></td> <td width="148" valign="top" bgcolor="#C9D8DD"><div class="navdroite" height="100%"> <?php include('navdroite.php'); ?></div></td> <td width="38" valign="top" background="images/fond_body_nav_d.gif"><img src="http://www.ville-joeuf.Fr/v2/images/body_d.jpg" width="38" height="401" hspace="0" vspace="0"></td> </tr> </table> <div class="pied"> <?php include('pied.php'); ?> </div>
www.ville-joeuf.fr/v2/index.php


et le code de ma page qui est dans un dossier :

Code : Tout sélectionner

<div class="haut" > <?php include('../haut.php'); ?> <table width="976" height="100%" border="0" align="center" valign="top" cellpadding="0" cellspacing="0"> <tr> <td width="38" valign="top" background="../images/fond_body_nav_g.gif"><img src="http://www.ville-joeuf.fr/v2/images/body_g.jpg" width="38" height="401" hspace="0" vspace="0"></td> <td width="148" valign="top" bgcolor="#C9D8DD"><div class="navgauche" height="100%"> <?php include('../navgauche.php'); ?></div></td> <td width="604" height="100%" valign="top" bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td><img src="../images/pix_trans.gif" width="604" height="9" hspace="0" vspace="0" border="0"></td> </tr> <tr> <td bgcolor="#CCCCCC"><img src="../images/pix_trans.gif" width="604" height="1" hspace="0" vspace="0" border="0"></td> </tr> </table> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td>&nbsp;</td> </tr> </table></td> <td width="148" valign="top" bgcolor="#C9D8DD"><div class="navdroite" height="100%"> <?php include('../navdroite.php'); ?></div></td> <td width="38" valign="top" background="../images/fond_body_nav_d.gif"><img src="http://www.ville-joeuf.Fr/v2/images/body_d.jpg" width="38" height="401" hspace="0" vspace="0"></td> </tr> </table> <div class="pied"> <?php include('../pied.php'); ?> </div>
www.ville-joeuf.fr/v2/recherche/recherche.php

j'ai bien les "../" qui indique qu'il descend dans l'arborescence mais le chemin des images du fichier "includé" ne changent pas (evidemment).
La solution serait que je mette les chemins des fichiers haut.php, navdroite.php, navgauche.php et pied.php en absolus, mais vu que je fais les test dans un repertoire "V2" il faudra que je rechange tout lorsque le site sera bon pour etre en ligne....

Eléphant du PHP | 451 Messages

28 janv. 2009, 19:49

Dans ta page recherche les liens vers les fichier css ne sont pas bon regarde ton code source dans ton navigateur sur la page recherche.

Petit nouveau ! | 7 Messages

02 févr. 2009, 10:22

Css, quel est le rapport ?

Le probleme est que contrairement a l'Iframe, mon fichier appelé par l'include s'affiche mais que les images non, je ne fais appel a aucun style css.

merci