Make Your Own CMS

o0slowpaul0o

New Member
Messages
254
Reaction score
0
Points
0
In this tutuorial I will show you how you can make your own basic but easy to update CMS. It will include making navigation, site stats, login system, news and whatever you want as extra on the side (such as a shoutbox or an affiliate rotator). First we will be making the .inc (include files) which will be used on pretty much every page, I am making them in .inc files so you don't have to go through 30 long pages of code just to change a spelling error!

1. Since this is a PHP tutorial, I'm not going to be making a CMS that is really graphical and fancy. First we will be setting up the MySQL database to take in the stats like hits, vistor's IP, people online and also a section for the news that will be shown on the front page. So first create a database called cmstut or whatever you want to call the database as long as you change which database it selects on each page. This first table will set up the stats and will be a modification of what we did in this tutorial, Site Stats. This will be called statscreate.php.

Code:
<?php
// set your infomation.
$dbhost='localhost';
$dbusername='username';
$dbuserpass='password';
$dbname='cmstut';

// connect to the mysql database server.
mysql_connect ($dbhost, $dbusername, $dbuserpass);
//select the database
mysql_select_db($dbname) or die('Cannot select database');

//create the table, customize it if you want
$query = 'CREATE TABLE stats(
id INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY(id),
ip VARCHAR(255) NOT NULL,
hits INT(20) NOT NULL,
activity DATETIME NOT NULL,
user_agent VARCHAR(255) NOT NULL)';
$result = mysql_query($query);
echo "Table Created!";
?>

The next table we will create is peep_online so you can call this file peep_onlinecreate.php.

Code:
<?php
// set your infomation.
$dbhost='localhost';
$dbusername='username';
$dbuserpass='password';
$dbname='cmstut';

// connect to the mysql database server.
mysql_connect ($dbhost, $dbusername, $dbuserpass);
//select the database
mysql_select_db($dbname) or die('Cannot select database');

//create the table, customize it if you want
$query = "CREATE TABLE peep_online(
activity DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
member ENUM('y','n') NOT NULL DEFAULT 'n',
ip_address VARCHAR(255) NOT NULL,
refurl VARCHAR(255) NOT NULL,
user_agent VARCHAR(255) NOT NULL)";
$result = mysql_query($query);
echo "Table Created!";
?>

The last table we will create for now, is the news section which is very simple. Call this file mainnewscreate.php.

Code:
<?php
// set your infomation.
$dbhost='localhost';
$dbusername='username';
$dbuserpass='password';
$dbname='cmstut';

// connect to the mysql database server.
mysql_connect ($dbhost, $dbusername, $dbuserpass);
//select the database
mysql_select_db($dbname) or die('Cannot select database');

//create the table, customize it if you want
$query = 'CREATE TABLE mainnews(
id INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY(id),
date TIMESTAMP NOT NULL,
post VARCHAR(100) NOT NULL,
news TEXT NOT NULL,
title VARCHAR(30) NOT NULL)';
$result = mysql_query($query);
echo "Table Created!";
?>

Now we should have three tables in our database:
mainnews
peep_online
stats
These are all the tables we need for now until we set up the login system.

2. Now we will need a basic design for our site, you can make one yourself but it may be a bit confusing for the less advanced. You can view the layout I made here. To use it to work with this tutorial you can go here to download it (includes the .psd's).

3. Basically we will be arranging it into 7 different .inc files, which will be made up of the basics shown on each page. These will include a header.inc (banner, <head>, and column headers), navigation.inc (add/remove new pages in the navigation area), user.inc (this will be the user login area or the user stats if they are logged in), affiliate.inc (this will list the affiliates which you can either make to store them manually or you can make it list from a MySQL database), stats.inc (this will show the site statistics such as hits or unique hits, you will not be changing this manually but it's .inc file because you may want to add a stat), other.inc (this is for whatever you want to put in the "other" column), and finally footer.inc (this is basically the copyright, but it will be a .inc file incase you change domains or want to add an ad down there, it just makes life a whole lot easier).

PLease NOTE: Lost the other part of the Tutorial, i'll post it when i find it. Hope you understand my stupidity.
 
Last edited:

MicrotechXP

New Member
Messages
7,644
Reaction score
0
Points
0
Very Nice tutoraial! I am shure this will help people that wanat to make there own.
 

o0slowpaul0o

New Member
Messages
254
Reaction score
0
Points
0
Auvee said:
Good tutorial slowpaul. I've noticed you've been making lots of tutorials for the community here, I was wondering if you would be interested in becoming a tutorial writer for ElementFx (a new project of mine)?

-Auvee B.

Sure thing, life abit sucky right now, but I can come on every now and then....Hoping to be mod of this place. >.<;;; Nah, joking. Sure I'll do it and thanks for the comments. Oh yeah just call me Pauly, Paul-O or Paul. ^.^;;
 

n4tec

Active Member
Messages
3,312
Reaction score
0
Points
36
really nice tutorial you have there.. Keep up your good work..
 

Arucard98

New Member
Messages
320
Reaction score
0
Points
0
Thx! This will definately help me out with what I want to do with my website!

Bookmarked!
 
S

saulito

Guest
ooOoooo...I have been looking for a tutorial like this! please finish!
 
Top