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]
< ?php
/*
Plugin Name: PluginSmarty
Plugin URI: http://imthi.com/#
Description: This is simple plugin to use smarty for backend.
Author: Imthiaz Rafiq
Version: 1.0
Author URI: http://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();
?>
[/php]
If you like to see the implentation please download this file. I have just made it work here please change according to your neeeds.
June 23rd, 2006 at 2:37 pm
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.
June 24th, 2006 at 12:18 am
Yes Philip I accept Wordpress has its limitation. But it can be used as a small scale cms.
June 26th, 2006 at 8:06 pm
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.
June 27th, 2006 at 4:28 am
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
July 6th, 2006 at 8:57 pm
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
March 24th, 2008 at 9:56 am
I am really interested in Smarty. Now, I will see, what I can help you in mixing workdress to it.