Hi,
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.
Hi,
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.
$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.
I'd recommend the PHP plugin standard for a plugin system. See the sample implementation, which also unifies configuration management. It doesn't define a specific plugin API; and it's generally best to go with a hooks system like Wordpress or Drupal (usually function hooks, but you can use static or instantiated callables as well).
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.