can we write php tag libararies just like in java's tld?
No; PHP is a scripting language that gets interpreted between <?php
(and <?=
if short tags are enabled) and ?>
tags. Any other tag is something different than PHP.
What you can do is use template engines like Smarty or TBS, which let you use other tags to separate PHP logic from presentation, but that's as far as you can go.
I do not recommend using PHP
to parse other 'pseudo' code
files, because this will end up in huge performance leaks.
Template engines are not the first choice, because PHP IS ALREADY a scripting language which allows templates, as said above: Use (short) tags within your HTML files and add them at the end of your process.
For more information about that topic look at MVC patterns ;)
精彩评论