I am building an template engine and I am thinking to use preg_split(); but instead of using ‘{‘ and ‘}’ I am thinking to use ‘[@’ and ‘@]’ but I would like to implement functionality like in smarty. { tag_to_replace | escape_html } and I would like to be able to get everything after the | delimiter. What should be the best way to implement that functionality.
Thank you all in advance!
Please don’t give me suggestions to use SMARTY or any other template engine. I am building my own PHP Framework (for learning purposes) and would like to implement one. Thank you very much.
Cheers!
This is very good short “cheat sheet” and testing tool for regular expressions, play with it. But i agree – template engine should be much simpler.
http://www.pagecolumn.com/tool/pregtest.htm