Hallo,
here is my problem....

I have a site who has, 150 pages (html) wich are often changing (the content).OK I made a header.php,a footer.php,and an index.php files. Now how should I proceed to get the hml. without using a Mysql? or should a include the header and the footer in each html....?
is there a solution about this? thanks 😃

here is my index.php:

<?php
switch ($id)
{
case 1: include ("bgb_358_alt_0.htm"); break;
case 2: include ("plitt_nuen.htm"); break;
case 3: include ("plitt_bamb.htm"); break;
case 4: include ("plitt_erlan.htm"); break;
case 5: include ("plitt_nuen.htm"); break;
case 6: include ("oeff-Recht/oe-schachtie-zitate-hitliste.html"); break;
case 7: include ("oeff-Recht/Verfassungsrecht/Staatsgrundlagen/oe-kant-text.html"); break;
case 8: include ("oeff-Recht/Verfassungsrecht/Staatsgrundlagen/oe-vertrauensschutz-text.html"); break;
default: include("main1.php"); break;
}
?>
<?php include("footer.php"); ?>

please help!

    You wont be able to include the header/footer.php in the htm files if they have the .htm/l extension because the server won't parse for php tags unless the file extension is .php or possibly .php3 - I think you are right to use the index.php and pull the page content through there in between the header/footer include statements. I'm not sure which function u need to grab the html from the pages and include it into the index.php but u could start by looking at fread() in the php manual (http://php.net)

      the thing is that I have more then 150 pages and the layout is made from tables,right, so what I need is that in this center table of the page i want those 150 pages to apear and the rest of the layout to remain.( stay)
      for this I used the include function for all those pages ( include header, footer) but still does not get I want.thanks

        Goto http://php.net/fread and look for yourself, but here is what you need (I think). In the file test.php I put:

        // get contents of a file into a string
        $filename = "./testing.htm";
        $handle = fopen ($filename, "r");
        $contents = fread ($handle, filesize ($filename));
        fclose ($handle);
        

        Then echo $contents into the table cell you want it displayed:

        <table width="620" border="0" cellspacing="0" cellpadding="2">
        <tr>
        <td width="129" rowspan="2"><a href="#">menu here</a></td>
        <td width="483"><h2>header here</h></td>
        </tr>
        <tr>
        <td><? echo $contents; ?></td>
        </tr>
        </table>
        

        In the file 'testing.htm' is :

        <h>Some html:</h><br>
        In here we have loads of <b>HTML</b> Text.<br>
        Some of it <u>Underlined</u>, some of it <i>Italicised</i>.<br>
        

        You can see the result here but not for long 😃
        Hope that helps.

          I don't understand why you are using a switch statement to bring in include files (need more explanation why you are doing this).

          I would do something like this:

          header.php

          <table>
          <tr><td>whatever</td></tr>
          </table>

          footer.php

          <table>
          <tr><td>whatever</td></tr>
          </table>

          File1.php

          require_once("header.php");

          <table>
          <tr><td>whatever stuff goes here for file 1</td></tr>
          </table>

          require_once("footer.php");

          .
          .
          .

          File150.php

          require_once("header.php");

          <table>
          <tr><td>whatever stuff goes here for file 150</td></tr>
          </table>

          require_once("footer.php");

            thanks for your help, I really do but let's see if I got this straight

            take a look(if you please) at www.salomonia.info
            and you see it is all made by tables.
            ok the layout is all you can see except the main table.If click on Gesetzestexte – Auswahl-Beispiele under the picture (the first link) will take you at a second file (content.php) wich has the same layout but diffrent stuff in the main table (center)

            ok, now the rest of my 150 files( html) I want them to be included into this main table( when I click on the links). Get my dilema?

            thanks again, I will try your solutions and see what happens

              Write a Reply...