Friday, February 24, 2012

Why dont you create your own CMS???--Part 6

For any vehicle to move,it is essential to have an engine.In our 'stupid' cms the 'engine.php' will serve as the engine.
  • Open stupid >>> main folder.
  • create a file and name it as engine.php.
  • create another file and name is as functions.php
  • open 'engine.php' in an editor and write the following code.
The functions.php will contain the simple and essential functions to perform a specific task.
We will complete our functions.php later.For time being we are going to concentrate on our engine.php.

global $db,$theme;

$db=new Database();
$theme=new Theme();



Let me briefly describe the code.
First of all we icluded the functions and configuration file.
Then the essential classes were included.
After including the core files,we instantiated the classes using 'new' operator and assigned it to global variable '$db' and '$theme'.Remember the global $db used in theme_class.php.
$db=new Database();
$theme= new Theme();
The database connection will already be made.Now its time to load our theme.The codes
will do the work for us.I told you "thats the magic of oop".

In the next post we will create our first theme called "default".
It will be easy and great ,if you are familiar with CSS.
Stay tuned...............!


Post a Comment