By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,751 Members | 1,149 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,751 IT Pros & Developers. It's quick & easy.

Storing/Retrieving/Executing Php

P: n/a
I want to creating an application where all my php(with html) is stored in the database.
So my index.php would find the appropriate the php file associated with the index page. It should execute this new code
as part of the original index.php. Can you please let me know if it is doable?
Thanks,
--
-Ankur Gupta
Jul 16 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
"Ankur Gupta" <ag****@cc.gatech.edu> wrote in message
news:bi**********@solaria.cc.gatech.edu...
I want to creating an application where all my php(with html) is stored in the database. So my index.php would find the appropriate the php file associated with the index page. It should execute this new code as part of the original index.php. Can you please let me know if it

is doable?

Yes this is doable with http://php.net/eval

Why you would want to do something like that I'm not sure - a database
would be more suited to storing the data as opposed to the code.
Jul 16 '05 #2

P: n/a
Ankur Gupta <ag****@cc.gatech.edu> wrote in message
news:<bi**********@solaria.cc.gatech.edu>...

I want to creating an application where all my php(with html)
is stored in the database. So my index.php would find the
appropriate the php file associated with the index page. It
should execute this new code as part of the original index.php.
Can you please let me know if it is doable?


Yes. Read about the eval() function; you will have to use it
extensively:

http://www.php.net/eval

Cheers,
NC
Jul 16 '05 #3

P: n/a
powerboy <po******@rarextreme.com> wrote:
: "Ankur Gupta" <ag****@cc.gatech.edu> wrote in message
: news:bi**********@solaria.cc.gatech.edu...
:> I want to creating an application where all my php(with html) is
: stored in the database.
:> So my index.php would find the appropriate the php file associated
: with the index page. It should execute this new code
:> as part of the original index.php. Can you please let me know if it
: is doable?

: Yes this is doable with http://php.net/eval

: Why you would want to do something like that I'm not sure - a database
: would be more suited to storing the data as opposed to the code.

The idea is to have bunch of templates and associate them with a page. So for instance,
each user can have totally different looking index page based on their preferences.

So when a user is directed to a index.php page. This page would have the code
to find an appropriate template and render it.

I am still having problems with using eval function though. Here's what I am trying to do:

<?php
$var = "2344";
$phpCode = '<html><body><?php echo $var; ?> </body></html>';
echo $phpCode. "\n";
eval ("\$phpCode = \"$phpCode\";");
echo $phpCode. "\n";
?>
No output why??
Thanks,

--
-Ankur Gupta
Jul 16 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.