Extending WordPress – the actual power

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

By Imthiaz

Programmer, SAAS, CMS & CRM framework designer, Love Linux & Apple products, Currently addicted to mobile development & working @bluebeetle

12 comments

  1. Yeah surely you can create out of WordPress a CMS System. But I don’t think that it’s really supposed to be a fully one(just for blogging). In my opinion it’s not on the same step as Joomla/Mambo/Drupal or any other real CMS.
    For my WordPress offers not enough clarity for all the content, which isn’t blogged.

  2. Whenever I’ve looked at the WordPress PHP code, I’ve been kind of horrified. Very hard to follow. I’m just glad that WordPress works.

  3. Hello,
    I did download Your plugin and installed it on my local server. It shows up in the plugin list as activated.
    But there is no change in my wordpress page. Could You give me an example, where to write the Smarty tags?

    I use Smarty for all my other projects, so the usage of Smarty is not the problem.

    Many Thanks
    Felyx

  4. though i’ve never worked with smarty – yet – , i’m also interested in a quick’n’simple example that demonstrates what this extension does. regards erik

  5. I fully agree: WordPress is very easy to extend. To create a CMS or Webshop is absolutely no problem.
    Regarding Smarty: Please try this little test. Google for “Magento Speed” and “Prestashop Speed” and compare the comments 🙂
    Magento doesn’t use Smarty, PrestaShop does.

    Ok-will try out you plugin now.

  6. I’ve begun using wordpress for all of my websites. The the simplicity and extensiveness of its expandability is incredible. My latest site is 100% CMS in wordpress.

Comments are closed.