Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

external include pages 4 newbie

Status
Not open for further replies.

gus121

Technical User
Joined
May 9, 2002
Messages
298
Location
GB

Hi there I am a complete newbie to PHP as an ASP web developer who has not writen a single line of php before!
I am currently working on a new company website which is to be hosted on a linux server. Which has PHP and CGI pearl support on it.

My problem Is that I wish the menus top and side menus to be in external web pages like this as I would do in windows IIS <-- include file=&quot;include.asp&quot; -->.

The ISP has told me that they do not support server side includes. Is there any way of simply coding in external webpages to load into the html webpage body.

Thanks for your help
Angus

Angus
 
In php, you can just use include('pageNameHere.ext') and it will be included as per usual, though if it is another php page, you have to make sure that it still has the start and end <?php ?> tags.
 
thanks can these be full path links ie. http:\\localhost\some-website\pageNamehere.ext. ?

Angus
 
include() can use either filesystem paths or URLs.

The filesystem paths do not have to be in the document root of the current server -- they can be anywhere on the filesytem. &quot;C:/foo/bar/includefile.ext&quot; or &quot;/home/foo/bar/includefile.ext&quot; are examples from Win32 and Unix-like OSes, respectively.

You can use a URL if the PHP runtime configuration directive &quot;allow_url_fopen&quot; is set to &quot;on&quot;.

If the file to be included is on the same system as the script, I recommend that you use the filesystem path to the file. Going across URLs can lead to a degradation of performance.

Want the best answers? Ask the best questions: TANSTAAFL!
 
FYI and to just amend sleipnirs post:

It has of course to be true that the user as whom PHP runs has access rights to the files. If you run PHP in SAFE mode further restrictions apply, e.g. you can't include files that you don't own. There are provisions for group ID based access in safe mode and a safe-Mode_include dir that allows for files of other owners to be included.
 
Thanks for all your help.
Can some one explain to me in basic terms where i can check if the runtime configuration directive &quot;allow_url_fopen&quot; is set to &quot;on&quot;.
Or what mode PHP is running in and how I can check this?

Thanks again for your help most appreciated for newbie.

Angus
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top