How do I make a template function? [closed]
//TEMPLATE FILE
<html>
f_blog_title();
</html>
//TEMPLATE LOAD
<?php
ob_start();
echo file_get_contents('TEMPLATE FILE');
ob_end_flush();
?>
Now my problem is, how to search f_???() and run ??? function?
If you're trying to build your own templating system, maybe you should look at existing ones and learn from the way they do it; Smarty seems most accessible for a beginner.
Smarty sucks - it does not force you to keep logic out of output and you'll be finaly creating code with compromises.
Try some fully XMLized as http://phptal.org/ it's actualy my choice to be honest. It's very clean and very easy to use. And the most important thing - it force you to keep logic in Your PHP code outside of templates.
精彩评论