Re: include() error
| From: | Lars Torben Wilson | Date: | Tue, 29 Aug 2000 01:34:12 +0000 |
| Subject: | Re: include() error | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-14040@lists.php.net to get a copy of this message | ||
Dave Jones writes:
> If you think about what you are doing, you are inserting html into the
> middle of a php code area. Try making the included file be something
> like:
>
> ?>
> <p>testing 1 2 3</p>
> <?php
>
>
> Otherwise the html code in the second file is between the <?php and ?>
> of the first file, so the interpreter is trying to parse html as php
> code, which should (and did) give you a parsing error..
No, that's incorrect. When include()ing or require()ing, PHP drops out
of code mode into HTML mode. If an include file contains PHP code
which is to be executed, it needs to be wrapped in <?php..?> tags.
For more information, read
http://www.php.net/manual/function.include.php
--
+----------------------------------------------------------------+
|Torben Wilson <torben@php.net> Netmill iTech|
|http://www.coastnet.com/~torben http://www.netmill.fi|
|Ph: 1 250 383-9735 torben@netmill.fi|
+----------------------------------------------------------------+