Forum Moderators: coopster

Message Too Old, No Replies

Will PHP do this?

         

camaroboy

2:29 am on Jul 28, 2008 (gmt 0)

10+ Year Member



One of my websites is about 50 pages and each page is saved as an htm file. I wrote the html code for the site and it is very straight forward and simple.

I am getting ready to add another 20 pages or so to the site and am wondering if I can use PHP or something else for the top of page, left, right, and bottom of page. My problem is everytime I want to change a link at the bottom or a category on the left I have to change it on all 50 pages! Takes forever. Any way I can make a file for just those parts and then call each page of the site to get them?

MattAU

2:48 am on Jul 28, 2008 (gmt 0)

10+ Year Member



Yes. [php.net...]

camaroboy

3:39 am on Jul 28, 2008 (gmt 0)

10+ Year Member



I read the page and I dont really get it. If I were to create a php file called "topofpage.php" what would I put into the page to add what is in that file?

eelixduppy

6:04 am on Jul 28, 2008 (gmt 0)



Let's say you have 4 files, top.php, bottom.php, content.html, and index.php where index.php is the file to be accessed via the browser. Then index.php would contain the following code:

<?php
include("top.php");
include("content.html"); # contains page-specific content.
include("bottom.php");
?>

This is just an example. You can expand on this idea to create a templating system by making the content.html include dynamic.