Lightweight PHP5 based template class/system

后端 未结 6 2113
遥遥无期
遥遥无期 2020-12-16 03:08

Looking at using a template system for a new project, it\'s only a small site and don\'t want to use the overhead and \'complexity\' of smarty. I don\'t really like template

6条回答
  •  鱼传尺愫
    2020-12-16 03:54

    PHP by itself is already a template engine. So why not cut out the overhead a template engine written in a template engine brings with it and just use PHP then?

    If you need added functionality, consider using ViewHelper, e.g. small functions that encapsulate stuff like adding links names or translating, e.g.

     $item): ?>
        
    id); ?> description); ?>

    If that's too verbose, have a look at HEREDOC and NOWDOC syntax and if this is still not what you are looking for, here is a list of some template engines:

    • http://www.webresourcesdepot.com/19-promising-php-template-engines/
    • http://en.wikipedia.org/wiki/Web_template_system#Server-side_systems

    Or, if you feel experimental, have a look at XHP, Facebook's extension approach to a Template engine:

    • http://www.facebook.com/notes/facebook-engineering/xhp-a-new-way-to-write-php/294003943919
    • http://toys.lerdorf.com/archives/54-A-quick-look-at-XHP.html
    • https://github.com/hhvm/xhp-lib

提交回复
热议问题