Re: Question about how to do this...
| From: | mike cullerton | Date: | Mon, 09 Jul 2001 05:01:17 +0000 |
| Subject: | Re: Question about how to do this... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-56875@lists.php.net to get a copy of this message | ||
on 7/8/01 10:58 PM, Steve Werby at steve-lists@befriend.com wrote:
> "Ben Bleything" <bleythbe@mailbox.orst.edu> wrote:
>> I believe (and I'm sure someone will correct me if I'm wrong) that
>> whenever you 'include' or 'require' a file, it drops to regular HTML
>> mode... so, yes, you will need to use <?php tags at the beginning and ?>
>> tags at the ends =>
>
> Think of the behavior of include() as copying the exact text from your code
> in the include'd file and pasting it as is into the calling code...a la
> paper and scissors. There is no special transformation. So if the code in
> the include'd file would have needed PHP codes if it was directly within the
> calling code then it needs it in the include'd file too and if it wouldn't
> have in the calling code then it won't in the include'd file.
from http://php.net/include
An important note about how this works is that when a file is include()ed or
require()ed, parsing drops out of PHP mode and into HTML mode at the
beginning of the target file, and resumes again at the end. For this reason,
any code inside the target file which should be executed as PHP code must be
enclosed within valid PHP start and end tags.
-- mike cullerton