Get Smarty

Donate

Smarty Icon

You may use the Smarty logo according to the trademark notice.

Smarty Template Engine Smarty Template Engine

For sponsorship, advertising, news or other inquiries, contact us at:

Sites Using Smarty

Buy cheap glasses from Cheapglasses123.com and save up to 80%.

Where to buy prescription glasses? EyewearCanada.com is your best choice!

Where to buy discount wedding dresses and cheap smart dresses free shipping - Weddingdresstrend.com

Shop for 2018 World Cup Football Boots Online sale at guthjcc.com

Browse best 2018 world cup soccer cleats and shoes from SoccerAzteca.com

Advertisement

Bab 16. Extending Smarty With Plugins

Version 2.0 introduced the plugin architecture that is used for almost all the customizable functionality of Smarty. This includes:

  • functions
  • modifiers
  • block functions
  • compiler functions
  • prefilters
  • postfilters
  • outputfilters
  • resources
  • inserts
With the exception of resources, backwards compatibility with the old way of registering handler functions via register_* API is preserved. If you did not use the API but instead modified the class variables $custom_funcs, $custom_mods, and other ones directly, then you will need to adjust your scripts to either use the API or convert your custom functionality into plugins.

Bagaimana Plugin Bekerja

Plugin selalu diambil saat dibutuhkan. Hanya pengubah tertentu, fungsi, sumber daya, dll yang diminta dalam naskah template akan diambil. Selanjutnya, setiap plugin diambil hanya sekali, meskipun anda mempunyai beberapa turunan Smarty yang berjalan dalam permintaan yang sama.

Pre/postfilters dan filter output sedikit dari hal khusus. Karena tidak disetbutkan dalam template, ini harus didaftarkan atau diambil secara eksplisit melalui fungis API sebelum template diproses. Urutan di mana multipel filter dengan tipe sama dijalankan tergantung pada urutan di mana ia didaftarkan atau diambil.

Direktori plugin dapat berupa string yang berisi path atau array yang berisi multipel path. Untuk menginstalasi sebuah plugin, cukup tempatkan dalam salah satu direktori dan Smarty akan menggunakannya secara otomatis.

Comments
No comments for this page.
Post a Comment
All comments are moderated. Support questions are ignored, use the forums instead.
Author:
Email: (not shown)
What is 20 plus 10? (Are you human?)

Advertisement