Go Back   Netpond ™ > Webmaster Forums and Resources > Tutorials
Register FAQ Calendar Radio and TV NP Shop Search Today's Posts Mark Forums Read

Tutorials Tutorials and helpful articles made by ponders for ponders

Orgy, Pissing, Shemale
Megasite, Gay, Shemale, Fetish Megasite, Gay, Shemale, Fetish
Reply
 
LinkBack Thread Tools Display Modes
Old 11-28-2006, 02:59 PM   #1 (permalink)
REßEL
She cries MORE MORE MORE!
 
REßEL's Avatar
 
Join Date: Feb 2004
Location: Apparently I'm a bitch a cunt a fuckhead and a troll. I'm also RIGHT!
Posts: 9,188
Points: 14,581
Send a message via ICQ to REßEL
Tutorial: Using PHP Includes To Work Smarter Not Harder.

In the old days of the web, frames were used to combine pages so that you only needed one navigation page or footer. Most hosting packages these days come with php. You can use PHP to "combine" several pages into one. And even have them as a standard template for your site building purposes that you add design to later.

1: In your text editor or wysiwyg of choice create the main page of your site "index.php"

2: Paste the following line into a blank document.
Code:
<h1>Header</h1>
Save as header.html

3: Paste the following line into a blank document.
Code:
<p>Sales Text Goes Here<br /><a href="#" title="keyword title">Sales Link Here</a></p>
Save as ad1.html

4: Paste the following line into a blank document.
Code:
<a href="#" title="keyword home">Home</a><br /> <a href="#" title="keyword page1">Page 1</a><br /> <a href="#" title="keyword page2">Page 2</a><br /> <a href="#" title="keyword page3">Page 3</a><br /> <a href="#" title="keyword page4">Page 4</a><br /> <a href="#" title="keyword page5">Page 5</a><br />
Save as navigation.html

5: Paste the following line into a blank document.
Code:
<p>Sales Text Goes Here<br /><a href="#" title="keyword title">Sales Link Here</a></p>
Save as ad2.html

6: Paste the following line into a blank document.
Code:
<a href="#" title="link1 title">Link 1</a><br /> <a href="#" title="link2 title">Link 2</a><br /> <a href="#" title="link3 title">Link 3</a><br /> <a href="#" title="link4 title">Link 4</a><br /> <a href="#" title="link5 title">Link 5</a><br />
Save as links.html

7: Paste the following line into a blank document.
Code:
<p>Sales Text Goes Here<br /><a href="#" title="keyword title">Sales Link Here</a></p>
Save as ad3.html

8: Paste the following line into a blank document.
Code:
<a href="#" title="home title">Home</a> | <a href="#" title="privacy title">Privacy</a> | <a href="#" title="terms title">Terms</a> | <a href="#" title="site map title">Site Map</a> | <a href="#" title="contact title">Contact</a>
Save as footer.html

9: Open your index.php file and paste the following between the body tags.
PHP Code:
<?php include("header.html"); ?>
<?php 
include("ad1.html"); ?>
<?php 
include("navigation.html"); ?>
<?php 
include("ad2.html"); ?>
<?php 
include("links.html"); ?>
<?php 
include("ad3.html"); ?>
<?php 
include("footer.html"); ?>
10: Upload to server to check everything is working. You now have a very basic php includes site that you can add design, formatting and content to.

Basic Template example: Basic PHP Include Template
Basic Template Using 2 Column Table: Basic PHP Include Template

To create the above you just put the
PHP Code:
<?php include("filetobeincluded.html"); ?>
commands where you want them to appear - In other words the navigation.html, ad2.html and links.html would go in the left table cell and the header.html, ad1.html, ad3.html and footer.html would go in the right table cell, and your content would be put between the two ad.htmls as if making the page as normal. You can make them as complex or as simple as you like. It all depends on the html/scripts/graphics etc you put into the individual includes. I've just used simple basic examples. You can use as many or as few includes as you need. You can now edit the individual html pages to suit. Using includes on a multi-page site means only having to edit once to make the change on all the pages using the include. Want to swap out the sponsor in ad1.html? Change the html in that file and all the pages using it will reflect the change.

You now know how to use basic PHP includes to use one file on multiple pages.
__________________
I work smarter not harder with the following awesome tools!
Gallery Submitter | Blogs Organizer | Gallery Scraper | Site Organizer | Links Organizer

Last edited by REßEL : 04-23-2008 at 09:47 AM.
REßEL is offline   Reply With Quote Send a private message to REßEL
Old 11-28-2006, 03:04 PM   #2 (permalink)
haui
I cum in Peace :)
 
haui's Avatar
 
Join Date: Oct 2002
Location: The Cave :)
Posts: 24,723
Points: 41,038
Send a message via ICQ to haui
Cool beans, need to learn more about this php stuff also

Thanks Rebel!
haui is offline   Reply With Quote Send a private message to haui
Old 11-28-2006, 03:11 PM   #3 (permalink)
REßEL
She cries MORE MORE MORE!
 
REßEL's Avatar
 
Join Date: Feb 2004
Location: Apparently I'm a bitch a cunt a fuckhead and a troll. I'm also RIGHT!
Posts: 9,188
Points: 14,581
Send a message via ICQ to REßEL
Once you get the hang of it you do begin to wonder how you managed without it

When designing new sites I tend to start with the index page as normal and build it as a complete static page to look exactly how I want it to look "compiled". I then work out which areas of the page are the ones that will be repeated throughout the site, I then cut out those areas and paste them into the individual include files and include them back onto the index page. Some are obvious targets, header, footer, navigation, etc.
__________________
I work smarter not harder with the following awesome tools!
Gallery Submitter | Blogs Organizer | Gallery Scraper | Site Organizer | Links Organizer
REßEL is offline   Reply With Quote Send a private message to REßEL
Old 11-28-2006, 03:12 PM   #4 (permalink)
erots
future is now
 
erots's Avatar
 
Join Date: Jan 2006
Location: Elbonia
Posts: 3,581
Points: 30
awsome tutorial REßEL

Very many webmasters don't know anything about PHP and how it can help them, which makes me sad.
__________________
Nothing to look here
erots is online now   Reply With Quote Send a private message to erots
Old 11-28-2006, 03:13 PM   #5 (permalink)
haui
I cum in Peace :)
 
haui's Avatar
 
Join Date: Oct 2002
Location: The Cave :)
Posts: 24,723
Points: 41,038
Send a message via ICQ to haui
Quote:
Originally Posted by REßEL
Once you get the hang of it you do begin to wonder how you managed without it

When designing new sites I tend to start with the index page as normal and build it as a complete static page to look exactly how I want it to look "compiled". I then work out which areas of the page are the ones that will be repeated throughout the site, I then cut out those areas and paste them into the individual include files and include them back onto the index page. Some are obvious targets, header, footer, navigation, etc.
Makes allot of sense, gota try it out and wonder why this old (< me) guy did not figure this out earlier!
haui is offline   Reply With Quote Send a private message to haui
Old 11-28-2006, 03:18 PM   #6 (permalink)
Carrie
I have defied gods and demons...
 
Carrie's Avatar
 
Join Date: Oct 2002
Location: Virgin - nee
Posts: 2,554
Points: 0
Even better, you can use PHP's auto-prepend and auto-append feature to put your headers and footers on automatically, and cut down on the number of include calls on your page. But that involves fiddling with .htaccess, and we don't want to scare anyone off if they're new to php or includes.

I hope you're entering this one into the contest, and here's another reply just in case you are! (Got that 6-reply requirement, hehe)
__________________
Speak your mind, even if your voice shakes. --jayeff
Carrie is offline   Reply With Quote Send a private message to Carrie
Old 11-28-2006, 03:23 PM   #7 (permalink)
REßEL
She cries MORE MORE MORE!
 
REßEL's Avatar
 
Join Date: Feb 2004
Location: Apparently I'm a bitch a cunt a fuckhead and a troll. I'm also RIGHT!
Posts: 9,188
Points: 14,581
Send a message via ICQ to REßEL
Quote:
Originally Posted by Carrie
Even better, you can use PHP's auto-prepend and auto-append feature to put your headers and footers on automatically, and cut down on the number of include calls on your page. But that involves fiddling with .htaccess, and we don't want to scare anyone off if they're new to php or includes.

I hope you're entering this one into the contest, and here's another reply just in case you are! (Got that 6-reply requirement, hehe)
Yes it's why I didn't use any real formatting, and only used a basic table for the 2nd example. I wanted to stick to the basics of PHP includes rather than have to go into CSS or other areas of ease
__________________
I work smarter not harder with the following awesome tools!
Gallery Submitter | Blogs Organizer | Gallery Scraper | Site Organizer | Links Organizer
REßEL is offline   Reply With Quote Send a private message to REßEL
Old 11-28-2006, 03:35 PM   #8 (permalink)
erots
future is now
 
erots's Avatar
 
Join Date: Jan 2006
Location: Elbonia
Posts: 3,581
Points: 30
Here is a tip that fits well with this tutorial:

There have been rumors that search engines treat urls ending with .php differently than .html. Not sure if thats true but if that bother you then make a .htaccess file to a directory where your .php scripts are and then put these lines into this file:

Code:
RewriteEngine on
RewriteRule (.*).html$ $1\.php
now you can write filename.html instead of .php, mod_rewrite will change the .html part to .php for you
__________________
Nothing to look here
erots is online now   Reply With Quote Send a private message to erots
Old 11-28-2006, 03:46 PM   #9 (permalink)
PornFactory
Porn is my game!
 
PornFactory's Avatar
 
Join Date: Jun 2005
Location: Croatia
Posts: 10,496
Points: 420
Send a message via ICQ to PornFactory
Simple and useful! Great tutorial REßEL! Thanks!
__________________
VALINEO.com - Domain Name Management, Buy/Sell Domain Names, Webmaster Resources, Outsourcing, Services and more
Cheap Adult/Mainstream Hosting Plans !!! 1 Year Hosting Plans starting at $ 34,40 !!! VALINEO Best Hosting Deals
REAL WEBCAM MONEY MAKER | CHEAP FREESITE TEMPLATES - $60 for 28 templates - PM me |
PornFactory is online now   Reply With Quote Send a private message to PornFactory
Old 11-28-2006, 04:18 PM   #10 (permalink)
LerWick
How can i help ya ?
 
LerWick's Avatar
 
Join Date: Jun 2006
Location: Slovakia
Posts: 5,160
Points: 184
Send a message via ICQ to LerWick
very good tutorial, thank you
__________________
Start your business at Thumblogger, with**JuggCash**
LerWick is offline   Reply With Quote Send a private message to LerWick
Old 11-28-2006, 04:34 PM   #11 (permalink)
Mihx
I need a bit more space here. There is n
 
Mihx's Avatar
 
Join Date: Jan 2005
Location: Denmark
Posts: 7,254
Points: 1,172
PHP includes (or the shtml alternative) are absolutely invaluable (assuming you aren't using a CMS of some sort) if you have things like headers, menus, sidebars etc. that appear on many pages and need frequent or just occasional updates.

I'm pretty sure I would hate having to update the sidebar on 500+ pages on my review site every time I added a new review for instance .
__________________

Mike's Porn Site Reviews - because reading is good for you... Or something like that. Looking for a new site or sponsor to promote? Review sites can be pretty helpful. [For site owners: I'm currently not accepting new requests]
Mihx is online now   Reply With Quote Send a private message to Mihx
Old 11-28-2006, 04:40 PM   #12 (permalink)
BoardGoerge
I wear the pants at Netpond!
 
Join Date: Oct 2005
Posts: 265
Points: 10
yeah php can make life times easier ... too bad i don`t know shit about php .. good and simple tutorial every for guys like me
BoardGoerge is offline   Reply With Quote Send a private message to BoardGoerge
Old 11-28-2006, 04:58 PM   #13 (permalink)
anasporn
ask me about PANTIES!
 
anasporn's Avatar
 
Join Date: Jan 2006
Posts: 2,655
Points: 430
Send a message via AIM to anasporn
you make that look so simple Rebel, thank you! Added to my favorites.
__________________
Promote...PANTIES!!! Panties Sponsors I make money with
my tgp2 articles * webmaster-friendly * sensible * better ratios!
"Everyday you don't create something, is a lost sale somewhere down the road!" -Shifty
anasporn is online now   Reply With Quote Send a private message to anasporn
Old 11-28-2006, 05:02 PM   #14 (permalink)
JACOBKELL
Repressors must and will die
 
JACOBKELL's Avatar
 
Join Date: Aug 2005
Location: Varazdin,Croatia
Posts: 4,161
Points: 5
Send a message via ICQ to JACOBKELL Send a message via AIM to JACOBKELL Send a message via MSN to JACOBKELL Send a message via Yahoo to JACOBKELL
Holy shit this is something what i was just need!Even i know programming in HTML and PHP i didnt know how to determine when to use HTML and when PHP for building sites.
Now i know how.Thank you rebel !
__________________
nodbank.net-exchange popular currencies-paypal,epassporte,webmoney,egold,moneybookers,
mainstreamforumbucks
dedicated now-Reliable and stable web hosting
JACOBKELL is offline   Reply With Quote Send a private message to JACOBKELL
Old 11-28-2006, 05:10 PM   #15 (permalink)
Mihx
I need a bit more space here. There is n
 
Mihx's Avatar
 
Join Date: Jan 2005
Location: Denmark
Posts: 7,254
Points: 1,172
Quote:
Originally Posted by JACOBKELL
Holy shit this is something what i was just need!Even i know programming in HTML and PHP i didnt know how to determine when to use HTML and when PHP for building sites.
Now i know how.Thank you rebel !
Just a few simple lines of PHP mixed into an otherwise completely regular HTML page/site can often make life a whole lot easier by providing some really great features you can't do with HTML.

Just remember to either use a .php extension on your pages (doesn't matter if some of them don't contain a single line of php, I think it makes sense to use the same extensions for all pages of a site) or set up your htaccess to parse php code on pages with a .html extension as erots showed.
As far as I'm aware it makes absolutely no difference to the search engines these days whether you use one or the other. I might have five years ago, but not anymore.
__________________

Mike's Porn Site Reviews - because reading is good for you... Or something like that. Looking for a new site or sponsor to promote? Review sites can be pretty helpful. [For site owners: I'm currently not accepting new requests]
Mihx is online now   Reply With Quote Send a private message to Mihx
Old 11-28-2006, 05:22 PM   #16 (permalink)
mojoman
and the award for the most annoying avatar...
 
mojoman's Avatar
 
Join Date: Feb 2006
Posts: 3,736
Points: 1,620
wd rebel! and just to interject, if the menu was made as a list ie. [HTML]<ul><li>option one</li><li>option two</li>....</ul>[/HTML]

the layout can be styled into many different styles with css
__________________
Quote:
Originally Posted by God
And number eleven: "Thou shall not whore on forums"... What? What do you mean there isn't enough space?
mojoman is offline   Reply With Quote Send a private message to mojoman
Old 11-28-2006, 05:36 PM   #17 (permalink)
goodspirit
NetPond - my second home :)
 
goodspirit's Avatar
 
Join Date: May 2006
Location: If you need some high quality design, TGP's, galleries, anything... contact me
Posts: 5,613
Points: 755
Send a message via ICQ to goodspirit
Uuuuu PHP thing I like it...thank you REßEL
__________________

Need some high quality design?!...PM me!
Trade links with my blogs... ICQ:203090715 || Thunder-Ball.net - Member

Quote:
Originally Posted by facialfreak View Post
For as long as a man's hands will reach his dick, he will jack off... Being out of work just gives him more time to do it!
goodspirit is online now   Reply With Quote Send a private message to goodspirit
Old 11-28-2006, 05:48 PM   #18 (permalink)
REßEL
She cries MORE MORE MORE!
 
REßEL's Avatar
 
Join Date: Feb 2004
Location: Apparently I'm a bitch a cunt a fuckhead and a troll. I'm also RIGHT!
Posts: 9,188
Points: 14,581
Send a message via ICQ to REßEL
Quote:
Originally Posted by mojoman
wd rebel! and just to interject, if the menu was made as a list ie. [HTML]<ul><li>option one</li><li>option two</li>....</ul>[/HTML]

the layout can be styled into many different styles with css
Yes.. as I said before I intentionally went for the basic html route to prevent confusing the PHP include issue with other html/design/css issues.

I really wouldn't expect someone to use exactly those templates to create their sites. Just take them and then make proper design and formatting changes to suit their needs. Some using the tutorial may already be up to date on using CSS and know what to do design-wise to the html elements to make them work for them. Others may not know either, but trying to teach them PHP includes and CSS elements at the same time clouds the issue of both.
__________________
I work smarter not harder with the following awesome tools!
Gallery Submitter | Blogs Organizer | Gallery Scraper | Site Organizer | Links Organizer
REßEL is offline   Reply With Quote Send a private message to REßEL
Old 11-28-2006, 06:41 PM   #19 (permalink)
glowlite
AZ-IN, USA
 
glowlite's Avatar
 
Join Date: Dec 2005
Posts: 1,652
Points: 7
That's a really good basic starting point for people to enter the PHP realm REßEL. As erots implied, it makes life so much easier for WM's.

PHP combined with CSS and a smattering of MySql is the ultimate CMS tool, without the bloat. IMHO

Thanks for sharing REßEL, your instructions are clear and easy to grasp.
__________________
4 sale:CollegeSororitySex.com | 4 sale:CollegeNerdz.com | parkit:Best Adult Parking

glowlite is offline   Reply With Quote Send a private message to glowlite
Old 11-28-2006, 08:15 PM   #20 (permalink)