|
Posted by Marc Stoecklin on 06/08/05 17:24
Hi all,
I am trying to figure out how mixed HTML and PHP code (like one might
have in a normal PHP file) can be evaluated if it is stored in a
variable, e.g. obtained from a database query.
Unfortunately, the ``eval'' function only accepts pure PHP code which
(in addition) must not have any syntax errors.
My hope is that there exists a function similar to ``include(..)'' that
accepts a variable containing code. Or: is there a possibility to invoke
the parser of the ``include'' function to evaluate and execute mixed PHP
and HTML code?
Any other suggestions?
Thank you!
Marc.
Example :
=========
----sample HTML/PHP code stored in variable $code----
<form action="?action=<?php print(FORM_ACTION); ?>">
<input name="<?= INPUT_A ?>"
type="text"
value="<?php print(get_value(INPUT_A)); ?>" />
<input name="<?= INPUT_S ?>" value="Submit" />
</form>
----end sample HTML/PHP----
----sample PHP code----
<?php
// 1. build the container of a page ...
// 2. access database and retrieve the content code
// into $code
// 3. evaluate $code, similar to include(...)
?>
----end sample PHP code----
Navigation:
[Reply to this message]
|