[thelist] A tip with PHP
s t e f
stef at nota-bene.org
Tue Jul 17 10:47:31 CDT 2001
Damien Cola wrote:
>> Although I've got a question :
>>
>>
>>> $page = join ('', file ($fichier));
>>>
>>> echo $page;
>>
>> Why not use something like :
>> include($fichier);
>>
>> What do you think, people?
>
>
> I think that:
> "The include() statement includes and evaluates the specified file."
>
> That is not what I want to do, I want the content of a file to be placed in
> my variable $page. Then, only after, display it. (you could perform some
> "search and replace" before echoing the page)
>
> If you do include, obviously you gonna get errors, since the included file
> must be specialy tailored for your purpose, that is beginning by ?> and
> eventually finishing by <?php in order for the html to be displayed
> correctly..
I'm really not sure about this one.
Here's some code I just tested and it works quite well:
<?php
echo "<h1>this is before the include</h1>";
include("test.html");
echo "<h1>this is after the include</h1>";
?>
In test.html there's some plain <p>...</p> HTML, and everything works
fine. I guess that's what they mean by "code is evaluated and then
inserted"...
Never underestimate the power of PHP ;-)
--
s t e f
[ http://www.nota-bene.org/ ]
[ irc: irc1.fr.ircnet.net #notabene ]
More information about the thelist
mailing list