Help - Search - Members - Calendar
Full Version: Can Php Create Skeleton Pages
Zymic Webmaster Forums > Web Design & Development > Server Side Scripting > PHP
A10
I have no experience with server side scripting. No php knowledge. I am experience with application programming with c++ so I won't get too lost with programming concepts.

pardon the psuedo-code

I'd like to be able to create a page layout used on every page differing only by content.

something where a php script would display a common header and footer but the content in the middle would be dynamic depending on a link clicked

So say you had a header like this on page.php
CODE
<table bgcolor="black" width="810" height="850" align="center" valign="top">
<tr>

<td>


<table border="0" width="800" height="820" align="center" valign="top">
<tr>

<td colspan="2" align="center" valign="middle" height="125"  bgcolor="blue">
Table testing
</td>
</tr>

<tr>
<td width="175" align="center" valign="top"  bgcolor="red">
This is a new cell
</td>
<td align="center" valign="middle"  bgcolor="yellow">


with a footer like this:
CODE
</td>
</tr>
</table>

<center>
<span style="color: rgb(51, 204, 255);"><a style="color: rgb(51, 204, 255); text-decoration: none;" href="contact.php">Contact Us</a> | <a style="color: rgb(51, 204, 255); text-decoration: none;" href="hours.php">Hours and
Location</a> | <a style="color: rgb(51, 204, 255); text-decoration: none;" href="sitemap.php">Site Map</a></span>
</center>
</td>

</tr>
</table>



so that a page that said something to the effect of (contact.php)
CODE
<php include header.html>

Contact info:
Blah blah blah (433) 234-2345

<php include footer.html>


would display this
CODE
<table bgcolor="black" width="810" height="850" align="center" valign="top">
<tr>

<td>


<table border="0" width="800" height="820" align="center" valign="top">
<tr>

<td colspan="2" align="center" valign="middle" height="125"  bgcolor="blue">
Table testing
</td>
</tr>

<tr>
<td width="175" align="center" valign="top"  bgcolor="red">
This is a new cell
</td>
<td align="center" valign="middle"  bgcolor="yellow">
Contact info:
Blah blah blah (433) 234-2345
</td>
</tr>
</table>

<center>
<span style="color: rgb(51, 204, 255);"><a style="color: rgb(51, 204, 255); text-decoration: none;" href="contact.php">Contact Us</a> | <a style="color: rgb(51, 204, 255); text-decoration: none;" href="hours.php">Hours and
Location</a> | <a style="color: rgb(51, 204, 255); text-decoration: none;" href="sitemap.php">Site Map</a></span>
</center>
</td>

</tr>
</table>


can anyone give some insight?
Andrew
You are actually completely correct, but you're php coding is just slightly off, use:
CODE
<?php include("header.php"); ?>

Obviously header.php can be anything, header.html footer.php/html etc.
A10
thanks That works perfectly!
Andrew
You're welcome, glad I could help!
Suuciu
it is working?
Andrew
QUOTE(Suuciu @ Sep 2 2008, 11:14 AM) *
it is working?

Lol did you read his reply? "thanks That works perfectly!"

This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2012 Invision Power Services, Inc.