Alexander: Dateiaufruf klappt nicht.

Hallo,

als php-Neuling habe ich ein kleines Problem: Ich habe drei Dateien:
eine index.php, in die navigation.php und content.php reingezogen werden sollen. Über navigation.php kann ich bestimmte Seiten anwählen
(Seite1.php , Seite2.php).... .(Vgl. Anhang)
Allerdings funktioniert das Ganze nicht, die einzelnen Seiten werden nicht in die index reingezogen. Wo liegt der Fehler?

Herzlichen Dank

Alexander

----- index.php --------------------------------------------

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#FFFFFF" text="#000000">
<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td align="center" valign="middle">
    <table width="740" height="440" border="0" cellspacing="0" cellpadding="0">
      <tr>
         <td width="740" height="30">
      <!--Beginn Navigation -->
      <?php
       include("navigation.php");
       ?>
       <!--Ende Navigation -->
      <td>
    </tr>
     <tr>
         <td width="740" height="410" align="left" valign="top">
      <!--Beginn Inhalt-->
      <?php
       include("content.php");
       ?>
       <!--Ende Inhalt-->
      <td>
    </tr>
  </table>
 </td>
  </tr>
</table>
</body>
</html>

---------- Ende index.php --------------------------------------

---------- navigation.php --------------------------------------

<!--ANF  nav -->
<table width="740" height="50" border="0" cellspacing="0" cellpadding="0">
  <tr align="center" valign="middle">
    <td width="10" ><img src="img/dummy.gif" width="10" height="1"></td>
    <td width="144">
      <?php
   if ($site == "1.php") {
  ?>
      <img src="img/1_a.gif" width="144" height="25">
     <?php
  } else {
  ?>
  <a href="index.php?site=seite1.php"><img src="img/1.gif" width="144" height="25"></a>
   <?php
  }
  ?>
   </td>
    <td width="144">
       <?php
   if ($site == "2.php") {
  ?>
      <img src="img/2_a.gif" width="144" height="25">
     <?php
  } else {
  ?>
  <a href="index.php?site=seite2.php"><img src="img/2.gif" width="144" height="25"></a>
   <?php
  }
  ?>
 </td>
    <td width="144">
        <?php
   if ($site == "3.php") {
  ?>
      <img src="img/3_a.gif" width="144" height="25">
     <?php
  } else {
  ?>
  <a href="index.php?site=seite3.php"><img src="img/3.gif" width="144" height="25"></a>
   <?php
  }
  ?>

</td>
    <td width="144">
         <?php
   if ($site == "4.php") {
  ?>
      <img src="img/4_a.gif" width="144" height="25">
     <?php
  } else {
  ?>
  <a href="index.php?site=seite4.php"><img src="img/4.gif" width="144" height="25"></a>
   <?php
  }
  ?>
 </td>
    <td width="144"> </td>
    <td width="10" ><img src="img/dummy.gif" width="10" height="1"></td>
  </tr>
</table>

<!--Ende navigation.php -->

<!--beginn content.php-->
<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#000000">
  <tr>
    <td>
 <?php
 if ($site == "seite1") {
 include("seite1.php");
} elseif ($site == "seite2") {
 include("seite2.php");
} elseif ($site == "seite3") {
 include("seite3.php");
} elseif ($site == "seite4") {
 include("seite4.php");
}
?>
 </td>
  </tr>
</table>
<!--ende content.php-->

  1. hi.

    das ist mir jetzt zu viel code. und mir sieht das mit dem includen ein wenig umständlich aus. vielleicht kannst du ja aus diesem artikel http://www.alistapart.com/stories/phpcms/ ein paar ideen gewinnen.

    lg aw

    ----- index.php --------------------------------------------

    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>

    <body bgcolor="#FFFFFF" text="#000000">
    <table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td align="center" valign="middle">
        <table width="740" height="440" border="0" cellspacing="0" cellpadding="0">
          <tr>
             <td width="740" height="30">
          <!--Beginn Navigation -->
          <?php
           include("navigation.php");
           ?>
           <!--Ende Navigation -->
          <td>
        </tr>
         <tr>
             <td width="740" height="410" align="left" valign="top">
          <!--Beginn Inhalt-->
          <?php
           include("content.php");
           ?>
           <!--Ende Inhalt-->
          <td>
        </tr>
      </table>
    </td>
      </tr>
    </table>
    </body>
    </html>

    ---------- Ende index.php --------------------------------------

    ---------- navigation.php --------------------------------------

    <!--ANF  nav -->
    <table width="740" height="50" border="0" cellspacing="0" cellpadding="0">
      <tr align="center" valign="middle">
        <td width="10" ><img src="img/dummy.gif" width="10" height="1"></td>
        <td width="144">
          <?php
       if ($site == "1.php") {
      ?>
          <img src="img/1_a.gif" width="144" height="25">
         <?php
      } else {
      ?>
      <a href="index.php?site=seite1.php"><img src="img/1.gif" width="144" height="25"></a>
       <?php
      }
      ?>
       </td>
        <td width="144">
           <?php
       if ($site == "2.php") {
      ?>
          <img src="img/2_a.gif" width="144" height="25">
         <?php
      } else {
      ?>
      <a href="index.php?site=seite2.php"><img src="img/2.gif" width="144" height="25"></a>
       <?php
      }
      ?>
    </td>
        <td width="144">
            <?php
       if ($site == "3.php") {
      ?>
          <img src="img/3_a.gif" width="144" height="25">
         <?php
      } else {
      ?>
      <a href="index.php?site=seite3.php"><img src="img/3.gif" width="144" height="25"></a>
       <?php
      }
      ?>

    </td>
        <td width="144">
             <?php
       if ($site == "4.php") {
      ?>
          <img src="img/4_a.gif" width="144" height="25">
         <?php
      } else {
      ?>
      <a href="index.php?site=seite4.php"><img src="img/4.gif" width="144" height="25"></a>
       <?php
      }
      ?>
    </td>
        <td width="144"> </td>
        <td width="10" ><img src="img/dummy.gif" width="10" height="1"></td>
      </tr>
    </table>

    <!--Ende navigation.php -->

    <!--beginn content.php-->
    <table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#000000">
      <tr>
        <td>
    <?php
    if ($site == "seite1") {
    include("seite1.php");
    } elseif ($site == "seite2") {
    include("seite2.php");
    } elseif ($site == "seite3") {
    include("seite3.php");
    } elseif ($site == "seite4") {
    include("seite4.php");
    }
    ?>
    </td>
      </tr>
    </table>
    <!--ende content.php-->

    1. hallo,

      du brauchst doch die content.php gar nicht. setzte doch einfach

      <?php
      if (isset($_GET["site"]) == true) {
          include($_GET["site"]);
      }

      in Deine Index.

      die Navigation kannste so lassen!

      $_GET["site"], da register_globals ab Version 4.22 standartmäßig auf "off" gesetzt ist und damit die Übergebenen Variablen nur über das Array angesprochen werden können.

      Schönen Tag

      Bene