Page 1 of 1

Table Layouts using PHP

Posted: Fri Nov 22, 2002 8:58 pm
by rsanc
:cry: I'm looking so hard for a way to make table-menu layouts easier to update. If I want to add a link to the table, I'd have to edit over 100 webpages for that one link.

I know php can make that easier... Something about editing one page and all the webpages using that table will change to what I want. Does anyone know how to do this? :roll:

Posted: Fri Nov 22, 2002 11:01 pm
by mydimension
enter the include() function. lets say you have a menu:

Code: Select all

<table>
 <tr>
  <td>Item 1</td>
  <td>Item 2</td>
  <td>Item 3</td>
  . . . 
 </tr>
</table>
and you put that in a file menu.html

now you want to put that menu into you 100's of files. easy, watch this:

Code: Select all

<?php
//some content, some code

//now lets include that menu
include("menu.html");  //be sure to provide a correct relative path or absolute path to the file

//some more content, some more code
?>
and thats it. hope that helps

Posted: Sat Nov 23, 2002 2:59 am
by serg4444
You even don't need PHP, you can use ssi: make extention for your web-pages like .shtml and write <-#include file="file.html"->

Sincerely,
Sergey Booyny
AlarIT programmer
http://www.AlarIT.com