I am wondering how many people have really used the actually power and extensibility of the great WordPress. The more time I spend with it reading the code I come to know WordPress can be extended into a powerful cms. Trust me WordPress is not just blogging software and it’s more than that.

I know WordPress can be extended to any complex cms without changing a single line in the WordPress core. The more I dig the WordPress I feel really stupid for writing such poor code in Organizer plug-in. There are two ways by which you can extend your WordPress namely plug-in and themes.

I have used so many so many open source cms. But I just love to write a plug-in for WordPress for its simplicity and power. Long back I wrote in my blog that I want to bring smarty in WordPress. One good thing with smarty is when you code a big project it is very easy to handle the templates for you.


< ?php
/*
Plugin Name: PluginSmarty
Plugin URI: https://www.imthi.com/#
Description: This is simple plugin to use smarty for backend.
Author: Imthiaz Rafiq
Version: 1.0
Author URI: https://www.imthi.com/
*/

class pluginSmarty{
var $tp;
function pluginSmarty(){
add_action('admin_menu',array(&$this,"addPages"));
}
function initTemplates(){
define('SMARTY_DIR', dirname(__FILE__).'/smarty/');
require(SMARTY_DIR . 'Smarty.class.php');
$this->tp = new Smarty;
$this->tp->template_dir = dirname(__FILE__).'/templates/';
$this->tp->compile_dir = dirname(__FILE__) .'/cache/';
$this->tp->cache_dir = dirname(__FILE__) .'/cache/';
}
function addPages(){
add_management_page("PlugiSmarty","Smarty Test",1,"pluginSmarty",array(&$this,"showPage"));
}
function showPage(){
$this->initTemplates();
$this->tp->display("pluginSmarty.tpl");
}
}
$psmarty = new pluginSmarty();
?>

If you like to see the implentation please download this file. I have just made it work here please change according to your neeeds.

pluginSmarty.zip