| Search Me! Lots of information is found in this board. You can also ask general questions here if you'd like! This is the last stop on Surmunity. |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread |
|
|
#1 (permalink) |
|
URB4N 5K1LLZ
Super #1
Joined in Sep 2005
Lives in Orlando, FL
Hosted on SH63
2,660 posts
Gave thanks: 81
Thanked 128 times
|
[Article] PHP Includes
As you know, editing a website and it's pages can sometimes be a hassle on its own. No worries, we have a very easy-to-use solution for you. PHP Includes.
Using includes can help you tons if you have a large website with many pages to edit. Just think, you have over 100 pages worth of content, with a header and footer the same on every page, sadly when you have a new link to enter into either of these, you need to edit each and every one of those 100 pages separately. Sounds pretty gruesome huh? Well not anymore, using includes can help you go from editing 100 pages to only editing one or two files! How Does it Work? Usually you have a main header and footer design that never changes for each page, yet you constantly are editing it to add either new links or other things. This can very time consuming, so in order to cut down that time, seperate the header and footer into their own respective files. Make sure to save them with .php file format. (ex: header.php - footer.php) Once you have done this, delete them from the main page you took them from, leaving only the main content, or body of the page. Replace the deleted text with the following code: PHP Code:
Upload the pages and see the changes! Everything will look exactly the same as if you would have never changed anything! Now you can easily edit your header and footer with only two files for over 100 pages! This code can also apply to other files that you'd like to include in certain areas on your website, just remember to always have each file/page end in the .php format for it to work! Good luck! |
|
|
|
|
|
#2 (permalink) |
|
Surpass Developer
Excelling Contributor
Joined in Jan 2004
Lives in Florida
Hosted on decc.surpasshosting.com
520 posts
Gave thanks: 21
Thanked 78 times
|
Remember to never use variables inside includes unless the variable is properly sanitized
__________________
Mark Surpass Hosting Developer sɹnoʎ uɐɥʇ ɹǝʇʇǝq sı bıs ʎɯ |
|
|
|
|
|
#4 (permalink) |
|
after g, before i
Resident.
Joined in Jul 2004
Lives in N,BC,CA
8,089 posts
Gave thanks: 48
Thanked 131 times
|
If you're doing a lot of nested includes, you might want to use include_once. It'd be pretty poor design to run into the problem, but it doesn't really hurt.
|
|
|
|