Web Logic
Web Logic

Reputation:

Templating System and Plugin System

How to create template/theme system and plugin system for a custom CMS similar to Wordpress or joomla?

Edit:

I don't want to use any templating engine similar to wordpress; a reason why it is famous for templating.

Upvotes: 2

Views: 773

Answers (2)

johnW
johnW

Reputation: 132

if you're looking to build a custom CMS why don't you pick a php framework and build on top of it. Why build from scratch when you an start with a proven and tested framework. Codeigniter is dead simple and Yii has already built a plugin system into its framework via components and modules: http://www.yiiframework.com/doc/guide/basics.module

Unless you're just trying to learn for yourself, there's really no benefit to building from scratch.

Upvotes: 1

ITroubs
ITroubs

Reputation: 11215

$varArray = array('firstVar' => 'the value', 'secondVar' => 255);
$varArray['theThirdVar'] = 12345;
foreach($varArray as $name => $value){
    $$name = $value;
}
include ('templates/template.php');

in the template.php then do something like:

<?echo $firstVar;?>

this then should give you the Value

EDIT: This is a minimal example. You also could take a look into codeigniter source. They also use this kindo of Template System.

Upvotes: 0

Related Questions