{"id":7613,"date":"2009-12-24T20:05:43","date_gmt":"2009-12-24T20:05:43","guid":{"rendered":"https:\/\/wordpress.org\/plugins-wp\/smarty-for-wordpress\/"},"modified":"2020-08-23T11:37:08","modified_gmt":"2020-08-23T11:37:08","slug":"smarty-for-wordpress","status":"closed","type":"plugin","link":"https:\/\/wordpress.org\/plugins\/smarty-for-wordpress\/","author":2310037,"comment_status":"closed","ping_status":"closed","template":"","meta":{"version":"3.1.35","stable_tag":"trunk","tested":"5.5.18","requires":"2.8.6","requires_php":"","requires_plugins":"","header_name":"Smarty for Wordpress","header_author":"PressPage Entertainment Inc.","header_description":"","assets_banners_color":"","last_updated":"2020-08-23 11:37:08","external_support_url":"","external_repository_url":"","donate_link":"https:\/\/www.paypal.com\/cgi-bin\/webscr?cmd=_s-xclick&hosted_button_id=9674139","header_plugin_uri":"https:\/\/wordpress.org\/plugins\/smarty-for-wordpress\/","header_author_uri":"https:\/\/presspage.info\/","rating":0,"author_block_rating":0,"active_installs":60,"downloads":5975,"num_ratings":0,"support_threads":1,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","faq","changelog"],"tags":[],"upgrade_notice":{"":"<p>The next stable release of Smarty is available and this plugin upgraded appropriately.<\/p>"},"ratings":{"1":0,"2":0,"3":0,"4":0,"5":0},"assets_icons":[],"assets_banners":[],"assets_blueprints":{},"all_blocks":[],"tagged_versions":[],"block_files":[],"assets_screenshots":{"screenshot-1.jpg":{"filename":"screenshot-1.jpg","revision":2367300,"resolution":"1","location":"plugin"}},"screenshots":[],"jetpack_post_was_ever_published":false},"plugin_section":[],"plugin_tags":[57748],"plugin_category":[],"plugin_contributors":[87091],"plugin_business_model":[],"class_list":["post-7613","plugin","type-plugin","status-closed","hentry","plugin_tags-smarty-wp-smarty","plugin_contributors-phkcorp2005","plugin_committers-phkcorp2005"],"banners":[],"icons":{"svg":false,"icon":"https:\/\/s.w.org\/plugins\/geopattern-icon\/smarty-for-wordpress.svg","icon_2x":false,"generated":true},"screenshots":[{"src":"https:\/\/ps.w.org\/smarty-for-wordpress\/trunk\/screenshot-1.jpg?rev=2367300","caption":""}],"raw_content":"<!--section=description-->\n<p>Do you have Smarty templates that you would like to use in your wordpress blog?<\/p>\n\n<p>Do you want a fast track migration from Smarty to Wordpress?<\/p>\n\n<p>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.<\/p>\n\n<p>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?<\/p>\n\n<p>Stop! Don't throw away that Smarty Template file, Download Smarty for Wordpress, install, activate and use that Smarty template file in Wordpress TODAY!!!<\/p>\n\n<p>The following publication, \"Guide to Using Smarty for Wordpress Plugin\" available on\nAmazon at (http:\/\/www.amazon.com\/dp\/B00K5XTPL2) or Barnes &amp; 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\nin your wordpress blog.<\/p>\n\n<p><strong>Usage<\/strong><\/p>\n\n<p>First you need to create your Smarty directories under the theme path that you will be\nusing, e.g.<\/p>\n\n<p>themes\/theme_name\/templates<br \/>\nthemes\/theme_name\/templates_c<br \/>\nthemes\/theme_name\/cache<br \/>\nthemes\/theme_name\/config<br \/><\/p>\n\n<p>If you wish to turn off Wordpress themes by changing the constant WP_USE_THEMES to false, you also need to\nset the constant SMARTY_PATH in your wp-config file to the path containing your Smarty files. In addition, you\nneed to specify your Smarty Loader file. This file is your index.php replacement for the Smarty templates and \nobtain a copy of the smarty instance, make any necessary assignments and load your initial templates. The difference\nbetween this implementation and smarty-only, is you have the full wordpress codex at your dispoable from\nyour Smarty routines.<\/p>\n\n<p>You may use Smarty for Wordpress either in you PHP\/Theme files or from your Wordpress posts\nand pages. To use the API, simple invoke the function that returns the page\ninformation requested. There are three API's for this purpose:<\/p>\n\n<p>If you wish to use Smarty in your custom worpress php files, then<\/p>\n\n<ol>\n<li>Invoke the smarty_get_instance() function to get an instance of the Smarty class \nwith the directories preset to your current theme.<\/li>\n<li>The simply use the Smarty class members as you would normally use, e.g $mySmarty-&gt;assign('name','value');\nto assign a template variable with a value.<\/li>\n<\/ol>\n\n<p>You can also invoke the API's from your Wordpress pages\/posts through short codes.<\/p>\n\n<p>Create a Wordpress page and enter the following short code:<\/p>\n\n<pre><code>[smarty-display tpl=home.tpl] \n\nwhere home.tpl is your smarty template located in the templates path\n<\/code><\/pre>\n\n<p>If you want to pass a single variable with the template, use<\/p>\n\n<pre><code>[smarty-display tpl=home.tpl name=myVariable value=\"some value\"] \n\nwhere name is the variable name specified in you smarty template file, and\nvalue is the value to be passed to your smarty template file that the above\nvariable represents\n<\/code><\/pre>\n\n<p>if you want to pass multiple variables to the smarty template, use<\/p>\n\n<pre><code>[smarty-load-multiple tpl=home.tpl name='my1,my2,my3' value='1,2,test']\n\nwhere name holds a comma delimited list of smarty template variable names while\nvalue holds a comma delimited list of associated values for the variable names.\n<\/code><\/pre>\n\n<p>The admin page under Settings permits setting the following Smarty attributes:\n- SmartyBC, for enabling backward compatibility\n- Auto literal\n- Cache lifetime\n- Cache modified check\n- Config booleanized\n- Config overwrite\n- Config read hidden\n- Debugging\n- Force compile\n- PHP handling\n- Use sub-directories<\/p>\n\n<p>Testing Smarty for Wordpress can be accomplished by creating a post with the following shortcode,\n[smarty-test]<\/p>\n\n<p>Testing the Smarty Demo included in the Smarty distribution can be accomplished by creating a page or post with the following shortcode.\n[smarty-demo]<\/p>\n\n<h3>Credits<\/h3>\n\n<p>We make honorable mention to anyone who helps make Smarty for Wordpress a better plugin!<\/p>\n\n<h3>Contact<\/h3>\n\n<p>DO NOT ASK FOR SUPPORT FROM www.smarty.net!\nSupport is provided at https:\/\/github.com\/presspage2018\/smarty-for-wordpress\/issues. You will require a free account on github.com<\/p>\n\n<p>Please contact phkcorp2005@gmail.com or visit the above forum with questions, comments, or requests.<\/p>\n\n<!--section=installation-->\n<p>To instal this plugin, follow these steps:<\/p>\n\n<ol>\n<li>Download the plugin<\/li>\n<li>Extract the plugin to the <code>\/wp-content\/plugins\/<\/code> directory<\/li>\n<li>Create the Smarty directories under your theme path<\/li>\n<li>Activate the plugin through the 'Plugins' menu in WordPress<\/li>\n<li>You are now ready to use the plugin. See the Admin page from Settings|Smarty for Wordpress for\ntips and techniques on usage<\/li>\n<\/ol>\n\n<!--section=faq-->\n<p>Please do not be afraid of asking questions?<br \/><\/p>\n\n<p>(There are no stupid or dumb questions!)<\/p>\n<dl>\n<dt><h3>How can I dynamically set my Smarty variables before loading my Smarty template<\/h3><\/dt>\n<dd><ul>\n<li>Use a third party plugin called, Exec-PHP (<a href=\"http:\/\/wordpress.org\/extend\/plugins\/exec-php\/\">http:\/\/wordpress.org\/extend\/plugins\/exec-php\/<\/a>) permits execution of PHP code from the post\/page. You can them use smarty_get_instance to set your variables and load your template from within your WP pages\/posts.<\/li>\n<\/ul><\/dd>\n<dt><h3>How do I change WP_USE_THEMES to false without changing Wordpress core files like index.php<\/h3><\/dt>\n<dd><ul>\n<li>You need to install runkit on your web server and then in your wp-config.php, you need to add the following two lines: runkit_constant_remove('WP_USE_THEMES'); define('WP-USE_THEMES',false); Now Wordpres themes will be turned off and load the Smarty Loader instead, if enabled.<\/li>\n<li>See <a href=\"http:\/\/php.net\/manual\/en\/runkit.installation.php\">http:\/\/php.net\/manual\/en\/runkit.installation.php<\/a> for assistance on installing runkit<\/li>\n<\/ul><\/dd>\n<dt><h3>What configurations are needed to load Smarty without Wordpress themes<\/h3><\/dt>\n<dd><ul>\n<li>You need to specify two constants in your wp-config. <\/li>\n<li>define('SMARTY_PATH','\/var\/www\/smarty'); \/\/ where your smarty files are located<\/li>\n<li>define('SMARTY_LOADER','\/var\/www\/smartyloader.php'); \/\/ the name of the file which will load your smarty files<\/li>\n<\/ul><\/dd>\n<dt><h3>My Smarty templates are not loading from the Smarty loader, I just get a blank screen<\/h3><\/dt>\n<dd><ul>\n<li>You need to invoke the plugin function smarty_get_instance() and assign to your $smarty variable.<\/li>\n<\/ul><\/dd>\n<dt><h3>How do I access the WPDB object from the Smarty Loader<\/h3><\/dt>\n<dd><ul>\n<li>use the syntax global $wpdb; within the smarty loader file.<\/li>\n<\/ul><\/dd>\n\n<\/dl>\n\n<!--section=changelog-->\n<h4>3.1.35<\/h4>\n\n<ul>\n<li>Updated to Smarty Version 3.1.35<\/li>\n<\/ul>\n\n<h4>3.1.32<\/h4>\n\n<ul>\n<li>Fix \"constant WP_USE_THEMES - assumed 'WP_USE_THEMES' (this will throw an Error in a future version of PHP)\" error warning<\/li>\n<li>Updated to Smarty version 3.1.32<\/li>\n<\/ul>\n\n<h4>3.1.30.1<\/h4>\n\n<ul>\n<li>Fix loading issues with SmartyBC class<\/li>\n<\/ul>\n\n<h4>3.1.30<\/h4>\n\n<ul>\n<li>Updated to Smarty version 3.1.30, added SmartyBC setting<\/li>\n<\/ul>\n\n<h4>3.1.27.1<\/h4>\n\n<ul>\n<li>Updated Admin page<\/li>\n<\/ul>\n\n<h4>3.1.27<\/h4>\n\n<ul>\n<li>Updated to smarty version 3.1.27<\/li>\n<\/ul>\n\n<h4>3.1.21<\/h4>\n\n<ul>\n<li>Updated to smarty version 3.1.21<\/li>\n<\/ul>\n\n<h4>3.1.18<\/h4>\n\n<ul>\n<li>Updated to smarty version 3.1.18<\/li>\n<\/ul>\n\n<h4>3.1.13.4<\/h4>\n\n<ul>\n<li>Change child themes support to off by default, use the constant SMARTY_CHILDTHEMES = true, to turn on child themes support<\/li>\n<\/ul>\n\n<h4>3.1.13.3<\/h4>\n\n<ul>\n<li>Fix when WP_USE_THEMES is off, wp-login and wp-register will not load the smarty loader<\/li>\n<li>Enable child themes support, where the smarty files reside in the smarty directory structure under the theme selected including any child theme<\/li>\n<\/ul>\n\n<h4>3.1.13.2<\/h4>\n\n<ul>\n<li>Fix plugins array definition in smarty directory initialization routine as reported by a user.<\/li>\n<\/ul>\n\n<h4>3.1.13.1<\/h4>\n\n<ul>\n<li>Fix when WP_USE_THEMES is off, wp-admin will not load the smarty loader but permit access to Wordpress admin dashboard.<\/li>\n<\/ul>\n\n<h4>3.1.13<\/h4>\n\n<ul>\n<li>Upgrade to smarty version 3.1.13<\/li>\n<li>When WP_USE_THEMES is false, will load a user define Smarty loader, and now your Smarty templates have access to the Wordpress codex<\/li>\n<\/ul>\n\n<h4>3.0.7.2<\/h4>\n\n<ul>\n<li>Fix an issue when specifying multiple smarty plugin directories<\/li>\n<\/ul>\n\n<h4>3.0.7.1<\/h4>\n\n<ul>\n<li>Fix deprecated issue, function call 'assign_by_ref' is unknown or deprecated<\/li>\n<\/ul>\n\n<h4>3.0.7<\/h4>\n\n<ul>\n<li>Upgrade to smarty version 3.0.7<\/li>\n<li>Added support for smarty plugins and trusted user directories<\/li>\n<li>Added support to pass multiple variables to the template<\/li>\n<\/ul>\n\n<h4>3.0.5<\/h4>\n\n<ul>\n<li>Upgrade to smarty version 3.0.5<\/li>\n<\/ul>\n\n<h4>2.6.26.1<\/h4>\n\n<ul>\n<li>Added the smarty-display shortcode in addition to smarty-load <\/li>\n<\/ul>\n\n<h4>2.6.26<\/h4>\n\n<ul>\n<li>Modified from Smarty version 2.6.26 to work as a Wordpress plugin<\/li>\n<\/ul>","raw_excerpt":"Smarty for Wordpress permits your Smarty template file to be embedded in a Wordpress post\/page.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/7613","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=7613"}],"author":[{"embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/phkcorp2005"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=7613"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=7613"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=7613"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=7613"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=7613"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=7613"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}