-----Original Message-----
From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] 
Sent: 09 March 2009 19:55
To: Mayer, Jonathan
Cc: Gary; php-general@lists.php.net
Subject: RE: [PHP] Re: PHP includes

On Mon, 2009-03-09 at 15:10 +0000, Mayer, Jonathan wrote:
> >Thank you to everybody that replied...but it almost seems it is
> extra 
> >work.
> >I can understand using an include for a menu, since they tend to
> >often and it is on every page, but the normal content I am not
> understanding 
> >the benefit.  If I have a page that has unique content on it, that is
> to say 
> >no other page has this content, why would I want to create a separate
> file 
> >to be included on the page, why would I not simple put the content
> directly 
> >on the page itself?
> >What is the best type of file to be used as an include (.txt, .php).
> >Thanks again for all your help.
> There are some circumstances where that could be useful. I don't do it
> often, but one site I made a while ago was based on a standard main
> with the content "included" in. The content pages then had absolutely
> nothing except the unique text, so that redesigns to the site were
> easier in the futurem, because only one page needed to be edited. So
> entire site was based around a page.php?ID=x with the ID specifying
> include required.
> Such as an example might be a little out of date now, what with CSS
> so forth, but it was useful at the time.
> If I am including a file with password details, I usually make it
> something random (.inc, .sec, whatever) and hide it away somewhere
> inacessible
> Gary
> ""Gary"" <gwp...@ptd.net> wrote in message 
> news:8a.64.51087.33bf3...@pb1.pair.com...
> > I'm working on learning php and have been toying with includes, and
> am 
> > trying to figure the advantages/disadvantages to using them.
> >
> > I know that using them eliminates the need to "put" the files once
> altered 
> > as with a template, however, is that the only advantage.
> >
> > My particular concerns are with SEO and if the search engines and
> bots 
> > can read the page if it is made completely on includes?
> >
> > Any and all comments would be appreciated.
> >
> > Gary
> > 
Just thought I'd point out that it's recommended against giving non-php
extensions to PHP code pages. Basically, making all of your include
files .inc without the server correctly configured to recognise all .inc
files as PHP files, you are opening yourself up to possible hacks where
people put the URL of your include directly in their browser and view
all your code. Best thing is usually to name files like this:
filename.inc.php or some-such, and not filename.inc. 


Thanks Ash - that's an excellent point which I'll remember next time I'm

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

Reply via email to