[WordPress] 外掛分享: Smarty for WordPress

前言介紹

  • 這款 WordPress 外掛「Smarty for WordPress」是 2009-12-23 上架。 目前已經下架不再更新,不建議安裝使用。
  • 目前有 100 個安裝啟用數。
  • 上一次更新是 2020-08-23,距離現在已有 1715 天。超過一年沒更新,安裝要確認版本是否可用。以及後續維護問題!
  • 外掛最低要求 WordPress 2.8.6 以上版本才可以安裝。
  • 尚未有人給過這款外掛評分。
  • 論壇上目前有 1 個提問,問題解答率 0%

外掛協作開發者

phkcorp2005 |

外掛標籤

smarty wp-smarty |

內容簡介

er the WordPress dashboard allows you to configure the Smarty settings, such as the Smarty directories and the Smarty caching settings.

With Smarty for WordPress, you can easily incorporate your existing Smarty templates into your WordPress blog or create new templates using the Smarty engine. This plugin offers greater flexibility and ease for those who are familiar with the Smarty framework.

To get started, simply download, install, and activate the plugin. You can then embed your Smarty template file using a WordPress shortcode with the template file name and any variables you want to pass to the template file.

Whether you want to use Smarty templates in your PHP/Theme files or from your WordPress posts and pages, Smarty for WordPress offers three APIs to help you achieve your goals.

To use Smarty for WordPress, you first need to create your Smarty directories under the theme path you will be using. If you wish to turn off WordPress themes, you also need to set the constant SMARTY_PATH in your wp-config file to the path containing your Smarty files, and specify your Smarty Loader file. This file serves as your index.php replacement for the Smarty templates, allowing you to make any necessary assignments and load your initial templates.

With Smarty for WordPress, you can easily create WordPress pages and posts with short codes that allow you to pass variables to your Smarty template files. The admin page under the WordPress dashboard also offers a convenient way to configure Smarty settings, such as directories and caching options.

The simply use the Smarty class members as you would normally use, e.g $mySmarty->assign('name','value'); to assign a template variable with a value.

原文外掛簡介

Do you have Smarty templates that you would like to use in your wordpress blog?
Do you want a fast track migration from Smarty to WordPress?
Smarty for WordPress is the first plugin which incorporates a complete distribution of the Smarty template engine as a WordPress plug-in. You embed your Smarty template file by using a WordPress short code with the Smarty template file name and any variable which you want to be passed to your Smarty template file.
There are many useful frameworks written in Smarty and NOT WordPress, like XCart, that can NOW be implemented into WordPress with minimal changes and ease?
Stop! Don’t throw away that Smarty Template file, Download Smarty for WordPress, install, activate and use that Smarty template file in WordPress TODAY!!!
The following publication, “Guide to Using Smarty for WordPress Plugin” available on
Amazon at (http://www.amazon.com/dp/B00K5XTPL2) or Barnes & Noble (http://www.barnesandnoble.com/w/guide-to-the-smarty-for-wordpress-plugin-patrick-ingle/1123770360?ean=2940158127281) shows how to implement this framework plugin
in your wordpress blog.
Usage
First you need to create your Smarty directories under the theme path that you will be
using, e.g.
themes/theme_name/templates
themes/theme_name/templates_c
themes/theme_name/cache
themes/theme_name/config
If you wish to turn off WordPress themes by changing the constant WP_USE_THEMES to false, you also need to
set the constant SMARTY_PATH in your wp-config file to the path containing your Smarty files. In addition, you
need to specify your Smarty Loader file. This file is your index.php replacement for the Smarty templates and
obtain a copy of the smarty instance, make any necessary assignments and load your initial templates. The difference
between this implementation and smarty-only, is you have the full wordpress codex at your dispoable from
your Smarty routines.
You may use Smarty for WordPress either in you PHP/Theme files or from your WordPress posts
and pages. To use the API, simple invoke the function that returns the page
information requested. There are three API’s for this purpose:
If you wish to use Smarty in your custom worpress php files, then

Invoke the smarty_get_instance() function to get an instance of the Smarty class
with the directories preset to your current theme.
The simply use the Smarty class members as you would normally use, e.g $mySmarty->assign(‘name’,’value’);
to assign a template variable with a value.

You can also invoke the API’s from your WordPress pages/posts through short codes.
Create a WordPress page and enter the following short code:
[smarty-display tpl=home.tpl]

where home.tpl is your smarty template located in the templates path

If you want to pass a single variable with the template, use
[smarty-display tpl=home.tpl name=myVariable value="some value"]

where name is the variable name specified in you smarty template file, and
value is the value to be passed to your smarty template file that the above
variable represents

if you want to pass multiple variables to the smarty template, use
[smarty-load-multiple tpl=home.tpl name='my1,my2,my3' value='1,2,test']

where name holds a comma delimited list of smarty template variable names while
value holds a comma delimited list of associated values for the variable names.

The admin page under Settings permits setting the following Smarty attributes:
– SmartyBC, for enabling backward compatibility
– Auto literal
– Cache lifetime
– Cache modified check
– Config booleanized
– Config overwrite
– Config read hidden
– Debugging
– Force compile
– PHP handling
– Use sub-directories
Testing Smarty for WordPress can be accomplished by creating a post with the following shortcode,
[smarty-test]
Testing the Smarty Demo included in the Smarty distribution can be accomplished by creating a page or post with the following shortcode.
[smarty-demo]
Credits
We make honorable mention to anyone who helps make Smarty for WordPress a better plugin!
Contact
DO NOT ASK FOR SUPPORT FROM www.smarty.net!
Support is provided at https://github.com/presspage2018/smarty-for-wordpress/issues. You will require a free account on github.com
Please contact [email protected] or visit the above forum with questions, comments, or requests.

各版本下載點

  • 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
  • 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「Smarty for WordPress」來進行安裝。

(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。


最新版本

延伸相關外掛(你可能也想知道)

暫無相關外掛推薦。

文章
Filter
Apply Filters
Mastodon