| | |
User configurable php preprocessor and generator - is there any???
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
Hi,
I am looking for a free tool which let me write pure html + user defined special tags, which would be transformed on demand into php file. For example I can define source like this:
result would be
is there such a tool???
I am looking for a free tool which let me write pure html + user defined special tags, which would be transformed on demand into php file. For example I can define source like this:
php Syntax (Toggle Plain Text)
<html><body> <config/> <mysql> <form name="frm" action="nextstep.php"> <select name="xxx"> <query sql="select value, name from table where cathegory=@GET_cathegory";> <option value="%1">%2</option> </query> </select> </form> </mysql> </body></html>
result would be
php Syntax (Toggle Plain Text)
<html><body> <?php include_once ("config.php"); ?> <? include_once("mysql_open.php"); ?> <form name="frm" action="nextstep.php"> <select name="xxx"> ....code what generates dynamically set of options.... </select> </form> <? include_once("mysql_close.php"); ?> </body></html>
is there such a tool???
Last edited by peter_budo; Jan 13th, 2009 at 5:19 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Actually your "pure html" example looks almost identical to ColdFusion from Adobe or, similarly, Genshi in Python.
GCS d- s+ a-->? C++(++++) UL+++ P+>+++ L+++ E--- W+++
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r y+
PMs asking for help will not be answered, post on the forums. That's what they're there for.
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r y+
PMs asking for help will not be answered, post on the forums. That's what they're there for.
Yes, but cold fusion process page on runtime, but I need a code generator based on templates-samples which will be filles in XML-XSLT transformation style. Complicated parts will be written directly in PHP, but there are tons of stuff, which is nothing more than mechanical aplying design pattern and it can save time a lot + less bugs.
•
•
Join Date: Aug 2007
Posts: 165
Reputation:
Solved Threads: 18
Half of programming is learning to be an able toolsmith. 
If no such tool exists, you'll have to make your own, perhaps using a pair of existing tools: sed and m4:[list][*]sed() transforms the input to a form m4() can understand[*]m4() 'replaces' the macros with suitable PHP code.
But then, isn't an SGML/XML processor is supposed to be able to handle this? If so, then if your input looked more like:
then an XML processor should be able to produce the desired output. Here, <php_init_sql> is defined to output PHP code that handles the stuff done once-only in a PHP program (require-onces, includes, et al), including sql startup. <gen_select_sql> generates PHP code, that queries the DB and produces the complete <select>...</select>.
I think it all comes down to figuring out what you really want to accomplish. After that, it becomes straightforward and clear. Shoot, if the input is 'clean' enough, you could write shell scripts, awk scripts, perl scripts, sed scripts, even ex scripts to process it.

If no such tool exists, you'll have to make your own, perhaps using a pair of existing tools: sed and m4:[list][*]sed() transforms the input to a form m4() can understand[*]m4() 'replaces' the macros with suitable PHP code.
But then, isn't an SGML/XML processor is supposed to be able to handle this? If so, then if your input looked more like:
PHP Syntax (Toggle Plain Text)
<html><body> <php_init_sql /> <form name="frm" action="nextstep.php"> <gen_select_sql name="xxx" cols="value, name" table="select_opts" match="@GET_cathegory" option_format=" <option value=\"%1\">%2</option>\n" /> </form> <php_end_sql /> </body></html>
then an XML processor should be able to produce the desired output. Here, <php_init_sql> is defined to output PHP code that handles the stuff done once-only in a PHP program (require-onces, includes, et al), including sql startup. <gen_select_sql> generates PHP code, that queries the DB and produces the complete <select>...</select>.
I think it all comes down to figuring out what you really want to accomplish. After that, it becomes straightforward and clear. Shoot, if the input is 'clean' enough, you could write shell scripts, awk scripts, perl scripts, sed scripts, even ex scripts to process it.
![]() |
Other Threads in the PHP Forum
- Previous Thread: General Date Convertor and Calculator (Simple)
- Next Thread: HELP - php code to post all list box values
| Thread Tools | Search this Thread |
apache api array basic beginner binary body broken cache cakephp class cms code computing confirm cron curl customizableitems database date date/time delete display dynamic email error file filter folder form forms forum function functions gc_maxlifetime google header headmethod howtowriteathesis href htaccess html iframe image include ip javascript joomla limit link list login malfunction memmory memory menu mlm msqli_multi_query multiple mycodeisbad mysql navigation neutrality oop parameter parsing paypal pdf php phpmysql query question random recourse regex script search select seo server sessions snippet source space sql static system table thesishelp trouble tutorial update upload url variable video web webdesign xml youtube






