RE: Static Pages with PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 20 November 2006 11:24, Stut wrote:

> Ford, Mike wrote:
> > On 20 November 2006 05:42, Paul Novitski wrote:
> > 
> > > At 11/19/2006 08:50 PM, John Comerford wrote:
> > > 
> > > > I am new to PHP and I am looking at mixing dynamic and static
> > > > pages to build my web application.  I have a situation where,
> > > > depending on some parameters I will display a static page from
> > > > within my PHP code.  My question is, is there a 'trick' to
> > > > doing this or do I just read in the file and echo it out again ?
> > > > 
> > > http://php.net/file_get_contents
> > > echo file_get_contents('example.html');
> > > 
> > 
> > Better yet:
> > 
> >     readfile('example.html');
> > 
> > or even:
> > 
> >     include 'example.html';
> > 
> > My preference would be the include, but all of the options
> you've been given would do the job one way or another.
> > 
> 
> Using include for this is potentially dangerous since it will execute
> any PHP code contained within the file. Only use include if you are
> absolutely sure you trust the content of the files you are displaying.

True.  I should have mentioned that.

As all my such files are created within this office, and held in a non-public directory completely separate from the Web server's docroot, I feel sure enough I trust the content to do this.  If I had any files I was doubtful about, I guess I'd use the readfile().

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: m.ford@xxxxxxxxxxxxxx
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211 


To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux