Neo's Blog

首頁 相本 討論 書籤

分類目錄
本站日誌 (51)
碎碎唸啦 (173)
網站架設 (84)
程式設計 (161)
軟體使用 (69)
電子商務 (126)
經營奇想 (48)
基金理財 (11)
聰明消費 (87)
電影心得 (47)
開放原碼 (16)
工作記錄 (2)
毛毛小記 (9)
就是不同 (2)




歷史資料
 




July 04, 2005
[PHP] Smarty-Lite 與 PHPSavant

前幾天在 gslin 看到 Smarty-lite ,剛剛看了一下,似乎比較適合單純 template engine 需求的使用者。

Why use Smarty-Light 可以看到 Lite 版主要的差異:

Smarty-Light has a few disadvantages, though.

  • Smarty-Light does not have all the features of Smarty, such as pre/post/output filters, include_php tag, php tag, section tag, security features, and error handling.

  • Smarty-Light plugins and templates are not compatible with Smarty.

  • Smarty-Light has no support for objects/classes. This was removed for speed. (Besides, classes in PHP4 are slow as hell to begin with.)

  • Smarty-Light has no support for template resources. This was removed for speed. (Besides, who wants to load a template from a database. That's also slow as hell.)
  • 算是常用的 section tag 不能使用了,但還是可以用 foreach 來代替。

    不過 Smarty-Light 不支援 objects/classes 就比較麻煩了,直接傳遞 objects/classes 能很方便的架構出 MVC 的模式。如果 objects/classes 不能用的話,也可以轉成陣列來替代。

    最後一點挑釁味十足:

    Smarty-Light has no support for template resources. This was removed for speed. (Besides, who wants to load a template from a database. That's also slow as hell.)

    如果像 Movable Type 多人線上自訂 Template ,把 Template 存在資料庫做線上編輯或許是比較好的做法。當然也可以把 Template 做成檔案模式,只是有的時候統一由資料庫管理會比較好,主要還是看架構如何設計。

    另外 gslin 提到的 PHPSavant,這裡有一篇跟 Smarty 的比較可以參考一下:

    revjim.net : Smarty vs. PHPSavant
    http://revjim.net/item/10170/

    Paul M. Jones 回應 revjim.net :
    http://paul-m-jones.com/blog/index.php?p=72

    revjim 再回應:
    http://revjim.net/comments/10171/

    其它包含 PHPSavant 回應的文章:
    http://www.oreillynet.com/pub/wlg/6029?page=last&x-order=date

    http://www.phpguru.org/static/templating.html

    註: PHPSavant 目前我還沒實際用過,等有空用過了再來寫心得。^^

    PHPSavant 官方網址:
    http://phpsavant.com

     
    由 Neo 發表於 July 4, 2005 02:54 AM 收進你的MyShare個人書籤  

    剛剛看到 Smarty-lite 的作者已經不再維護這個專案了,可能會改由 flat frog 專案來繼續更新。

    http://sourceforge.net/projects/flatfrog


    Neo 發表於 January 29, 2006 08:36 PM

    感觉还是Smarty比lite的要好,i like Smarty!


    amao 發表於 June 26, 2006 08:26 AM
    發表迴響  
    (*星號開頭為必填欄位)











    (請輸入您看到的數字,看不到請按右鍵->顯示圖片)


    記住我的資訊?







    Copyright 2005 Neo's Blog All rights reserved.