Re: fread strangeness (was: nested echo and includes, mixed html / PHP)

From: Date: Tue, 20 Feb 2001 02:39:19 +0000
Subject: Re: fread strangeness (was: nested echo and includes, mixed html / PHP)
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-40685@lists.php.net to get a copy of this message
David - very cool, thanks much for your help! if any other newbies run into the same problem: echo "stuff"; //prints "stuff" echo $string; //prints contents of string, does NOT parse. include(filename); //whenever encountered, prints contents of file //parses only if PHP tags present. require(filename); //builds contents into page as if part of script //even if require() inside conditional 'false' //if doesn't parse right, script breaks. eval($string); //prints contents of $string AFTER parsing PHP tags. nesting them in multiple ways allows very dynamic code reuse and modular page building, which is your friend. cheers! jaxon On 2/19/01 8:03 PM, "David Robley" <huntsman@hermes.nisu.flinders.edu.au> wrote: > On Tue, 20 Feb 2001 11:37, Jaxon wrote: >> Same problem, found it's coming from somewhere else :( >> It looks as if fread or fopen is preventing PHP from from parsing ... >> >> index.php: >> >> <? >> $file="test.inc"; >> $fd = fopen ($file, "r"); >> $string = fread ($fd, filesize ($file)); >> fclose ($fd); >> echo "$string"; >> ?> >> >> test.inc: >> >> <html> >> <body> >> <? echo "this comes from inside of test.inc"; ?> >> </body> >> </html> >> >> index.html show a blank html page, with the contents of test.inc >> visible via view source...grr. how can I get it to actually parse the >> PHP? >> >> help! >> jaxon >> > > eval() is possibly what you need.

« previous php.general (#40685) next »