Tutorials
Fitting in with your site
-
Fitting in with your site
Posted on July 1, 2003
Written by
Sasha (view more by Sasha)
Comments (0)
Filed under Scripts: PHPFanBase, Tutorials
If you are unfamiliar with how headers and footers work in PHP, the following will show you how to make the script’s PHP pages fit in seamlessly with the rest of your site, without ever having to touch join.php, members.php and country.php. This greatly reduces the risk of you accidentally deleting some needed PHP coding, and the script not working because of this.
Open up the header.inc and footer.inc files that came with phpFB in your HTML editor. Also open up a typical page on your website, like perhaps your About page.
Take a look at the coding on that About page. At the top and bottom of the file, there are many lines of HTML coding that appear in every page on your website, right? These are usually the head of the document, maybe a top image, navigation, and in the footer, the closing body and HTML tags.
For example, say your About page looks like this:
<html><head> <title>Your Site</title> </head> <body> <table border="0"> <tr><td colspan="2"><img src="logo.jpg" border="0" alt="Your logo or main graphic"></td> </tr><tr> <td><h3>Sidebar</h3> <p><a href="#">Home</a><br> <a href="#">About</a><br> <a href="#">Join</a><br> <a href="#">Codes</a><br> <a href="#">Members</a><br> <a href="#">Extras</a></p></td> <td> <h2>About</h2> <p>Here you would put some text that would explain what your fanlisting is about.</p> </td></tr><tr> <td colspan="2">Here you could put a footer graphic or a disclaimer, etc.</td> </tr></table> </body></html>
Everything up until the <h2> tag containing the page title would appear on every page on your website. And everything below the closing p tag would appear on every page as well.
So instead of having this on every page, with PHP, you can put it in just one little file, and then make PHP include that file on all pages in your website. This means that if you ever wanted to edit it, you’d only have to edit the one file, instead of every page. This also means that by including headers and footers, you can completely change the layout of the .php pages that come with the script without actually editing the .php pages yourself.
In the case of the page above, you would paste the following into header.inc:
<html><head> <title>Your Site</title> </head> <body> <table border="0"> <tr><td colspan="2"><img src="logo.jpg" border="0" alt="Your logo or main graphic"></td> </tr><tr> <td><h3>Sidebar</h3> <p><a href="#">Home</a><br> <a href="#">About</a><br> <a href="#">Join</a><br> <a href="#">Codes</a><br> <a href="#">Members</a><br> <a href="#">Extras</a></p></td> <td>
And this would go into footer.inc:
</td></tr><tr> <td colspan="2">Here you could put a footer graphic or a disclaimer, etc.</td> </tr></table> </body></html>
Save both files, and upload them to the same directory join.php, members.php and country.php are in.
This should make the .php pages fit in seamlessly with the rest of your site without editing them.
Comments
Comments are closed for this entry.