IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Langage PHP Discussion :

Mes include() ne marchent pas


Sujet :

Langage PHP

  1. #1
    Futur Membre du Club
    Inscrit en
    Octobre 2003
    Messages
    4
    Détails du profil
    Informations forums :
    Inscription : Octobre 2003
    Messages : 4
    Points : 5
    Points
    5
    Par défaut Mes include() ne marchent pas
    Bonjour à tous,
    je ne réussis pas à inclure mes fichier au niveau du serveur qui héberge mon site php/mysql. En local(sur mon poste et même en réseau local) tout marche; mais une fois hébergé, rien ne vas plus. Mon code php ne fonctionne plus. Le principe est que le fichier index.php appelle les autres(path.php ; header.php ; footer.php ; menu_gauche.php ; menu_droite.php,connection.php). voici les codes.

    connection.php :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    <?php
    $con_serveur = mysql_connect("localhost", "root", "");
    $db = mysql_select_db("testa",$con_serveur);
    ?>
    path.php :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    <?php $path="testa/"; ?>
    header.php :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <script language="JavaScript" type="text/JavaScript">
    <!--
    function MM_reloadPage(init) {  //reloads the window if Nav4 resized
      if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
        document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
      else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
    }
    MM_reloadPage(true);
    //-->
    </script>
    <link href="../css/style.css" rel="stylesheet" type="text/css">
    </head>
     
    <body>
    <table cellspacing=0 cellpadding=2 width="89%" align=center>
      <tbody>
        <tr>
          <td align=middle><hr align="center" size="1" class="small">
              <div align="center" >          
                  <span class="small">Tous droits r&eacute;serv&eacute;s &copy; Copyright 2007 CIM. <a href="membre_enter.php">Espace priv&eacute;</a> | <a href="admin_enter.php">Administration</a> <br>
                <span class="small">Designed and Powered by </span></span><span class="smallbold">CGICOM</span><span class="small"><span class="small">. </span>
                <SPAN id=footer>Avertissement,&nbsp;Donn&eacute;es personnelles<SPAN 
                class=footer>&nbsp;et&nbsp;</SPAN>Conditions D'utilisation </SPAN>
                <SCRIPT language=Javascript>
    var footerLinks = document.getElementById('footer').getElementsByTagName('a');
    for (var i=0;i<footerLinks.length;i++) {
    	footerLinks[i].target = '_self';
    }
                        </SCRIPT>
                </span></span></font> </p>
          </div></td>
        </tr>
        <tr>
          <td valign=center nowrap align=middle><div align="center"><span class="style6"></span> </div></td>
        </tr>
      </tbody>
    </table>
    menu_gauche.php :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    <link href="../css/style.css" rel="stylesheet" type="text/css">
    <link href="../css/style.css" rel="stylesheet" type="text/css">
    <style type="text/css">
    <!--
    .Style7 {color: #A5C8DD}
    -->
    </style>
    <TABLE class=TBL_PERMANENT_NAVIGATION_BACKGROUND 
                      id=TBL_PERMANENT_NAVIGATION_BACKGROUND height="100%" 
                      cellSpacing=0 cellPadding=0 width="100%" bgColor=#A5C8DD 
                      border=0>
      <TBODY>
        <TR valign="top">
          <TD 
                          height=26 colspan="2" class=border_black id=FirstCell><div align="center">
            <p>Infos line <br>
                ou le
                <br>
            </p>
          </div></TD>
        </TR>
        <TR bgcolor="#015585" valign="top">
          <TD 
                          height=19 class=smallbold id=FirstCell>&nbsp;</TD>
          <TD bgcolor="#015585" class=smallbold id=FirstCell><span class="dataWhite">ORGANISATION</span></TD>
        </TR>
        <TR valign="top">
          <TD 
                          height=18 colspan="2" class=smallbold id=FirstCell><table width="98%" border="0" align="center" cellpadding="3" cellspacing="0">
            <tr>
              <td width="1%" class="data"><img src="../images/flecher.gif" width="4" height="6"></td>
              <td width="99%" class="data"><div align="left"><a href="presentation.php">Pr&eacute;sentation</a></div></td>
            </tr>
            </table></TD>
        </TR>
        <TR valign="top">
          <TD 
                          height=20 colspan="2" class=smallbold id=FirstCell>&nbsp;</TD>
        </TR>
        <TR bgcolor="#015585" valign="top">
          <TD 
                          height=20 class=smallbold id=FirstCell>&nbsp;</TD>
          <TD bgcolor="#015585" class=smallbold id=FirstCell><span class="dataWhite">ACTUALITE</span></TD>
        </TR>
        <TR valign="top">
          <TD 
                          height=20 colspan="2" class=PermTD id=FirstCell><table width="98%" border="0" align="center" cellpadding="3" cellspacing="0">
            <tr>
              <td class="data"><img src="../images/flecher.gif" width="4" height="6"></td>
              <td class="data"><div align="left"><a href="revue_presse.php">La revue de presse</a></div></td>
            </tr>        
          </table></TD>
        </TR>
     
        <td height="19">
      </TBODY>
    </TABLE>
    menu_droite.php :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    <link href="../css/style.css" rel="stylesheet" type="text/css">
    <link href="../css/style.css" rel="stylesheet" type="text/css">
    <style type="text/css">
    <!--
    body {
    	margin-left: 0px;
    	margin-top: 0px;
    	margin-right: 0px;
    	margin-bottom: 0px;
    }
    -->
    </style><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
      <?php
    	$sqlrubrique =" select * from rubrique where idrubrique > 0 AND statut=1 ";
    	//$sqltheme = $sqltheme." order by titretheme ";
    	//echo $sql;exit;
    	$rstrubrique=mysql_query($sqlrubrique);
    	$nb_lignes = mysql_num_rows($rstrubrique);
    	if ($nb_lignes>0)
    		{
    		$i=0;
    		While($rowrubrique=mysql_fetch_object($rstrubrique))
    			{	
    			$i++;
    ?>
      <tr>
        <td width="100%" colspan="4"><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
            <tr>
              <td width="100%" bgcolor="#A5C8DD"><div align="left"><a href="<?php if ($rowrubrique->idrubrique==2)echo "infos_pratiques.php"; if ($rowrubrique->idrubrique==4)echo "documentation.php";?>"><img src="../images/rubriques/<?php echo $rowrubrique->image; ?>"  alt="" border="0"></a> </div></td>
            </tr>
            <tr>
              <td  bgcolor="#015585"><span class="smallTitlewitebold"><?php echo $rowrubrique->titre ?></span></td>
            </tr>
        </table></td>
      </tr>
      <tr>
        <td colspan="4"><table width="100%" border="1" cellpadding="1" cellspacing="0" bordercolor="#015585">
            <?php
    	$sql =" select * from article where idarticle > 0 AND statut =1";
    	//if($_REQUEST['txt_recherche']){$sql = $sql." And nomprenomabonne like '%".$_REQUEST['txt_recherche']."%'";}
    	$sql = $sql." And idrubrique=".$rowrubrique->idrubrique;
    	$sql = $sql." order by priorite ";
    	$sql = $sql." LIMIT 0,2 ;";
    	//echo $sql;exit;
    	$rst1=mysql_query($sql);
    	$nb_lignes = mysql_num_rows($rst1);
    	if ($nb_lignes>0)
    		{
    		$j=0;
    		While($row=mysql_fetch_object($rst1))
    			{	
    			$j++;
    ?>
            <tr>
              <td valign="top"><div align="center">
                  <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td><span class="smallbold"><?php echo $row->titre;?></span><br>
                          <span class="small"> <?php echo $row->resume;?><br>
                        </span></td>
                    </tr>
                    <tr>
                      <td><div align="right"><span class="data"><a href="article_details.php?op=0<?php echo '&id='. $row->idarticle;?>" >Lire &gt;&gt;</a></span></div></td>
                    </tr>
                  </table>
              </div></td>
              <?php }
    					 ?>
            </tr>
            <?php
    	}
    ?>
        </table></td>
        <?php }?>
      </tr>
      <?php
    		}
    ?>
    </table><br>
    <p align="center">&nbsp;</p>
    index.php :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    <?php 
    include 'connection.php';
    include 'sessioncontrol_membre.php';
    ?>
    <html>
    <head>
    <title>test[index]</title>
    <link href="../css/style.css" rel="stylesheet" type="text/css">
    <style type="text/css">
    <!--
    body {
    	background-color: #015585;
    }
     
    -->
    </style></head>
     
    <body >
    <table width="775"  border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td width="12"><img src="../images/bord_haut_gauche.gif" width="12" height="12"></td>
        <td width="756" background="../images/ligne_haut.gif"><img src="../images/tab/tab_ul.gif" width="2" height="7"></td>
        <td width="12"><img src="../images/bord_haut_droit.gif" width="12" height="12"></td>
      </tr>
      <tr>
        <td background="../images/ligne_gauche.gif">&nbsp;</td>
          <td valign="top" bgcolor="#A5C8DD"><table width="100%" height="100" border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td><?php  include "header.php"; ?></td>
                </tr>
                <tr>
                  <td><div align="center">
                    <table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF" bgcolor="#FFFFFF">
                      <tr>
                        <td width="25%" valign="top" bgcolor="#A5C8DD"><?php  include "menu_gauche.php";?></td>
                        <td width="50%" valign="top" bgcolor="#F2F2F2"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                          <tr>
                            <td height="25" class="smallTitlewitebold">&nbsp;</td>
                          </tr>
                          <tr>
                            <td height="25" bgcolor="#015585" class="bkg_rouge"><div align="center">
                              INFORMATIONS GENERALES </div></td>
                          </tr>
                          <tr>
                            <td valign="top"><hr align="JUSTIFY" size="1" class="smallboldjaune">
                              </td>
                          </tr>
                          <tr>
                            <td>&nbsp;</td>
                          </tr>
                          <tr>
                            <td>&nbsp;</td>
                          </tr>
                        </table></td>
                        <td width="25%" valign="top" bgcolor="#A5C8DD"><?php  include "menu_droite.php";?></td>
                      </tr>
                    </table>
                  </div></td>
                </tr>
              </table>
              </td>
            </tr>
            <tr>
              <td>&nbsp;</td>
            </tr>
            <tr>
              <td><?php  include "footer.php";?></td>
            </tr>
          </table></td>
     
        <td background="../images/ligne_droite.gif">&nbsp;</td>
      </tr>
      <tr>
        <td><img src="../images/bord_bas_gauche.gif" width="12" height="12"></td>
        <td background="../images/ligne_droite.gif"><img src="../images/tab/tab_dl.gif" width="2" height="7"></td>
        <td><img src="../images/bord_bas_droit.gif" width="12" height="12"></td>
      </tr>
    </table>
    </body>
    </html>

  2. #2
    Membre éprouvé
    Avatar de ozzmax
    Inscrit en
    Novembre 2005
    Messages
    977
    Détails du profil
    Informations personnelles :
    Âge : 41

    Informations forums :
    Inscription : Novembre 2005
    Messages : 977
    Points : 959
    Points
    959
    Par défaut
    salut moi je mets tjrs mes includes comme premiere instruction
    mais j'utilise avec des parentheses comme suit

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
     
    <?
    include("../Classes/cDBConnect.php");
    session_start();
    ....
    ?>
    Pour le chemin d'accès il va aller voir directement dans le dossier de ta page donc les pages que t'include devraient être là, si ce n'est pas le cas ca ne marchera pas
    La perfection n'est pas un but, l'amélioration constante devrait l'être!
    La position des Développeurs de developpez avec les explications

  3. #3
    Membre régulier
    Profil pro
    Inscrit en
    Juillet 2003
    Messages
    69
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2003
    Messages : 69
    Points : 80
    Points
    80
    Par défaut
    pour ne pas me soucier des includepath, je fait généralement mes include comme ça :


    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    <?php
    include dirname(__FILE__).'/dossier/fichier.php';
    sans oublier d'utiliser include_once/require/require_once en cas de besoin
    de plus, je le ferme jamais les balise php (?>) à la fin de mes fichiers inclus (on est jamais à l'abris d'un caractère invisible caché), pour éviter les problèmes avec l'envoi de header.

  4. #4
    Membre averti
    Profil pro
    Inscrit en
    Février 2003
    Messages
    285
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2003
    Messages : 285
    Points : 300
    Points
    300
    Par défaut
    le plus simple, si tu connais le dossier de tes includes, c'est de partir du root

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    include($_SERVER['DOCUMENT_ROOT'].'/chemin/fichier.php');

  5. #5
    Futur Membre du Club
    Inscrit en
    Octobre 2003
    Messages
    4
    Détails du profil
    Informations forums :
    Inscription : Octobre 2003
    Messages : 4
    Points : 5
    Points
    5
    Par défaut Fin du pb des include()
    Bounjour, le code que je vous est exposé était parfait, c'est en fait le serveur de mon hébergeur qui faisait problème. Donc ne vous inquiétez plus tout vas bien. Merci aussi pour ceux qui ont contribués!
    A+++++++++++++ sur Develeppoez.net

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Mes animations ne marchent pas
    Par _youri dans le forum jQuery
    Réponses: 2
    Dernier message: 28/04/2014, 13h11
  2. [AC-2007] Mes applications ne marchent pas sous vista
    Par miamou dans le forum Runtime
    Réponses: 1
    Dernier message: 21/06/2010, 15h20
  3. Mes lumières ne marchent pas
    Par killwin dans le forum OpenGL
    Réponses: 1
    Dernier message: 29/09/2009, 01h17
  4. include n'inclu pas mes images
    Par gfj90 dans le forum Langage
    Réponses: 8
    Dernier message: 26/02/2007, 20h57
  5. Réponses: 7
    Dernier message: 21/07/2006, 14h51

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo