Holding Web pages in database

admin

Administrator
Staff member
I would like to set up a database driven way of serving web pages from a database and still allowing PHP script to work. Here's the idea so far:

I have a table set up with an ID, a page title, and a text field where I can put the HTML/PHP code of the page.

The problem is that when I grab the page from the database, the PHP code does not get interpretted/run. It simply is invisible unless you view the page source. The HMTL renders fine, but no PHP directives seem to work in this situation.

I thought it might be because it needed to do two-passes or something, so I made one page that does nothing but grab the page from the database, and then another page that include()s the grabber page, thinking that it would be able to read the PHP. It didn't. The output was exactly the same as if I had just shown the contents of the grabber page.

Does anyone have ideas about how I can get the PHP from the database to be executed? I'd like to stay away from redirecting the browser to a temporary text file if possible since I have a few ideas that would be cool to do, and I think would work better without relying on redirection and temporary files.

Any idea? Thanks a lot.

Dave
 
Back
Top