Table Layouts using PHP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
rsanc
Forum Newbie
Posts: 1
Joined: Fri Nov 22, 2002 8:58 pm

Table Layouts using PHP

Post 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:
User avatar
mydimension
Moderator
Posts: 531
Joined: Tue Apr 23, 2002 6:00 pm
Location: Lowell, MA USA
Contact:

Post 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
serg4444
Forum Newbie
Posts: 9
Joined: Fri Nov 22, 2002 10:27 am

Post 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
Post Reply