Old 02-06-2004, 06:27   #1 (permalink)
sleepingfish
css is for divs
 
sleepingfish's Avatar
 
Join Date: Feb 2003
Location: Norwich
Posts: 4,469
php includes for beginners links

I've been thinking about having a go at using PHP includes, I might also try ASP includes, I have no real preference as yet because I have pretty much no idea about either. But I do know that iframes are a bit poo, and includes seem to be the alternative of choice.

I would be grateful for a reply that cover the basics, but suspect it might be a bit much to explain by threads so links for me to read are all good as well.

I'm wondering about the real basics - do I need a database for this gubbins?

TIA
  Reply With Quote
Old 02-06-2004, 06:38   #2 (permalink)
Brown
volkswagen yellow & gold
 
Brown's Avatar
 
Join Date: Apr 2003
Location: london, england.
Posts: 6,147
its all in the zip i gave you.
  Reply With Quote
Old 02-06-2004, 06:39   #3 (permalink)
Stickman
Dr. Lucien Sanchez
 
Stickman's Avatar
 
Join Date: Mar 2003
Location: UK
Posts: 5,527
Don't keep it a secret.


PHP:

Code:
<html> <head> </head> <body> <?php include('include.txt'); ?> </body> </html>
Make sure the above is whatever.php and you're away.

You can use all sorts of includes (txt, htm, php etc) and to replace iframes just put it inside a div with your chosen overflow settings.
  Reply With Quote
Old 02-06-2004, 06:39   #4 (permalink)
Bill Posters
trouble free and loverlee
 
Join Date: Mar 2003
Location: YooKay
Posts: 2,939
http://www.outfront.net/tutorials_02.../includes3.htm
http://www.w3schools.com/php/php_includes.asp

plenty plenty


I personally prefer using PHP for various reasons, the main ones being that I know enough of it to get the task done and (therefore) using PHP for includes too fits in with existing PHP functions that I use.

One note:
When using PHP incudes you normally need to give the page containing the <?php include(…) ?> instruction a .php suffix.
As the stick said, the included files themselves can have other suffixes.
The rule being, that if a file contains <?php … ?> instructions, it needs to have the .php suffix in order to let the server know to pass the document through the php parser.
  Reply With Quote
Old 02-06-2004, 06:43   #5 (permalink)
sleepingfish
css is for divs
 
sleepingfish's Avatar
 
Join Date: Feb 2003
Location: Norwich
Posts: 4,469
Quote:
Originally Posted by Brown
its all in the zip i gave you.
sorry I haven't had a chance to look at it yet, and there's me asking silly questions

Thanks very much y'all.
  Reply With Quote
Old 04-06-2004, 12:32   #6 (permalink)
spacious
Registered User
 
Join Date: May 2004
Posts: 6
also note that when you first try it, depending on your server's settings (in the php.ini file) you may have to include the full path from your server's root. (usually this is what spits out in your error message) so instead of:

<?php include(someFile.txt); ?>

you may need to use :

<?php include(/some/path/to/your/incudes/someFile.txt); ?>

and don't forget there's other functions like require();

the best place, in my opinion, to read about it is always the source:

http://us4.php.net/manual/en/function.include.php
  Reply With Quote
Old 07-06-2004, 04:15   #7 (permalink)
sleepingfish
css is for divs
 
sleepingfish's Avatar
 
Join Date: Feb 2003
Location: Norwich
Posts: 4,469
Cheers
  Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Contact Us - Web Design Forums - Archive - Top
Search Engine Optimization by vBSEO 3.0.0 RC8