Re: Include code from database?
| From: | Meir kriheli | Date: | Thu, 09 Nov 2000 23:00:34 +0000 |
| Subject: | Re: Include code from database? | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-4348@lists.php.net to get a copy of this message | ||
On Thursday 09 November 2000 22:08, chris wrote:
> Is there any easy way to store PHP / HTML code in a database, and
> pull it into a running PHP script? I'd like to build a template-
> based system where every page is generated by a single script,
> which pulls page-specific content from a MySQL database. But I
> can't figure out how to include PHP code "on the fly," or if it's
> even possible.
>
> I'm thinking the script will probably have to create a temporary
> file on the local system, building it with the template and
> the content pulled, and then include() it; this seems exceedingly
> resource-intensive, however, and I'd like to find a better way.
> (I could do it on a RAM disk, but this is a shared box that I
> rent space on, so I don't have root access to set something like
> that up.)
>
> Thanks in advance!
>
> Chris
You should use the eval function. Pull the content from your db into a string
and feed it to the eval function.
See http://www.php.net/eval
--
Meir Kriheli
MKsoft computer systems
"There's someone in my head but it's not me" - Pink Floyd