Wednesday, February 29, 2012

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

So we have done the following in our previous lessons.
  • setup xampp!
  • created 'stupid' database with essential tables.
  • coded all the essential classes (database,theme).
  • completed our engine.php script.
Hey we have completed many files,now its time to check whether we are in the right path???
Remember the functions.php in the 'main' directory!!
Let us define some functions in 'functions.php'.
  • Open the file in an editor and write the following code.
/***************************
Shows the title of the page

****************************/
function title($title)
{
echo '<title>'.SITENAME.' : '.$title.'</title>';
}

/***************************
if your module has title
use this function to show title of app inside app block

****************************/
function app_title($app_title)
{
echo '<div id="app_title">'.$app_title.'</div>';
echo '<div id="spacer"></div>';
}
/***********************************
get site logo
***************************************/

function get_site_logo()
{
global $theme;
return $theme->get_sitelogo();
}


The functions are described below
  1. title ==> TO DEFINE THE TITLE OF A PAGE.
  2. app_title ==> TO DEFINE THE TITLE OF APP.
  3. get_site_logo ==> RETURNS THE SITELOGO.
More functions will be included later...

Now its time to create our first theme 'default'.
Please download the code and extract it into 'themes' folder.

Now open the 'index.php' in the stupid folder.
Include our 'engine.php' there.

<div id="container">
<div id="wrapper">
<?php 
require 'main/engine.php';
?>
</div>
</div>


After doing all these,run xampp.
Go to http://localhost/stupid/ from your browser.
If all came in our way,you will see a congratulation message.Otherwise please comment here so that I can understand the details of the error.

13 comments:

  1. Hello!!! Thank you very much for this great tutorial!!!!!! Can you please reupload the "default.rar" file?

    Thanks!!!!

    ReplyDelete
  2. sorry for the broken download link.
    You can get the theme in the next posts.

    ReplyDelete
  3. I didn't see that! Thank you very much!! You are the best!! :)

    ReplyDelete
  4. get the theme from here

    http://dl.dropbox.com/u/63550684/default.rar

    ReplyDelete
  5. it says "cannot connect to database"

    ReplyDelete
  6. Make sure that your database constants defined in base.php file are correct.
    Check whether the database table defined in base.php exists.

    ReplyDelete
  7. hey help me, i tried but nothing happened all blank

    ReplyDelete
  8. I am getting this error:

    Parse error: syntax error, unexpected T_OBJECT_OPERATOR in C:\xampp\htdocs\stupid\main\engine.php on line 15

    any ideas?

    ReplyDelete
  9. check the engine.php for any syntax error.
    If you can't find any errors please go on with the tutorial and download the full source file stupid cms.

    ReplyDelete
  10. it says Call to undefined function is_logged_in() in C:\xampp\htdocs\TA\include\header.php on line 5

    ReplyDelete
  11. Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\stupid\index.php:3) in C:\xampp\htdocs\stupid\include\session_class.php on line 5

    :(

    ReplyDelete
  12. Fatal error: Call to undefined function is_logged_in() in C:\wamp\www\stupid\themes\default\include\header.php on line 5

    please help

    ReplyDelete

  13. Please go on with the tutorial and download the full source file stupid cms from next chapters.

    ReplyDelete