|
|
|||||||
| 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 |
![]() |
![]() |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
She cries MORE MORE MORE!
|
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> 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> 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 /> 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> 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 /> 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> 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> 9: Open your index.php file and paste the following between the body tags. PHP Code:
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:
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. |
|
|
|
|
|
#3 (permalink) |
|
She cries MORE MORE MORE!
|
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 |
|
|
|
|
|
#5 (permalink) | |
|
I cum in Peace :)
|
Quote:
(< me) guy did not figure this out earlier! ![]() |
|
|
|
|
|
|
#6 (permalink) |
|
I have defied gods and demons...
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 |
|
|
|
|
|
#7 (permalink) | |
|
She cries MORE MORE MORE!
|
Quote:
![]() __________________
I work smarter not harder with the following awesome tools! Gallery Submitter | Blogs Organizer | Gallery Scraper | Site Organizer | Links Organizer |
|
|
|
|
|
|
#8 (permalink) |
|
future is now
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 ![]() __________________
Nothing to look here |
|
|
|
|
|
#9 (permalink) |
|
Porn is my game!
|
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 | |
|
|
|
|
|
#11 (permalink) |
|
I need a bit more space here. There is n
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 . |
|
|
|
|
|
#13 (permalink) |
|
ask me about PANTIES!
|
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 |
|
|
|
|
|
#14 (permalink) |
|
Repressors must and will die
|
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, dedicated now-Reliable and stable web hosting
mainstreamforumbucks |
|
|
|
|
|
#15 (permalink) | |
|
I need a bit more space here. There is n
Join Date: Jan 2005
Location: Denmark
Posts: 7,254
Points: 1,172
|
Quote:
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. |
|
|
|
|
|
|
#16 (permalink) | |
|
and the award for the most annoying 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:
|
|
|
|
|
|
|
#17 (permalink) |
|
NetPond - my second home :)
|
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 |
|
|
|
|
|
#18 (permalink) | |
|
She cries MORE MORE MORE!
|
Quote:
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 |
|
|
|
|
|
|
#19 (permalink) |
|
AZ-IN, USA
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
|
|
|
|