I have just finished my first CMS and well I just wanted to give a few helpful hints to anyone that is like me and new to php, programing and taking on such a project.

You can view what I am calling proclarush V1 at
You can view my CMS at http://proclarush.jamesriter.com/.

As soon as I get a chance I will be doing a full rundown of what is in my little CMS.

I never planed on making a CMS, in fact when I started I was just looking to build a simple reset with a few pages in place to help me put out demo pages faster. In fact MOST of what I know about PHP I learned building Proclarush (Thats the name I gave it).

Seeing that there is way to much to go over in one post and I done really feel like sitting down that long I am going to cover the basics and a few things you should keep in mind if you are going try and build your own.

First!! Know what you want out of it!
As I said when I started I was not planing to make a CMS of any kind and that its self has come to bite me in the ass more time than you could think of! There are many different kinds of CMSs out there so look around and see what you are aiming to do. Just to give you a few things to think about here are a list of some common things a CMS would be used for.

Blog:
Shopping cart:
Information:
Personal use:
Small business:
Large business:
And so on and so on…

So after you know what you want to do with it you will need to set the ground work. This is also something I did not do so well. Due to that there was a point where I wanted to change on thing and that alone made me change 6 other pages.

Lets get to the layout of things. This would be the main directory.


blog/
cache/
mobile/
proclarush/
sitemap/
wiki/

Keep in mind Proclarush is what I have named my system so you will want to come up with a name asao. :)

This is what inside of Proclarush looks like.

content/
css/
form/
images/
js/
media/
php/
plugin/
settings/
skins/

Now that you have a the main files in place it is time to start setting up some files.
Like all site you should start with an index.php but unlike a lot of site you are not going to start adding in content and images just yet. In fact there is not one div span or H tag in my index.php. I have under 15 lines of code that start it all off.


//Setting "Main_DIR" to /proclarush
define('Main_DIR', 'proclarush/');

//Pulling in the setting and directory page
include_once(Main_DIR.'/settings/directory.php');
include_once(Main_DIR.'/settings/settings.php');

//Pulling in the base skin
include_once(SKINS_DIR. 'base_skin.php');

?>

Well my index has a few more lines this is what you will need to get started. So lest go over this line my line and what is in each file that is being called in.

Line 1:
define('Main_DIR', 'proclarush/');
This is saying that “Mail_DIR” is equal to http://yoursite.com/proclarush

Line 2:
include_once(Main_DIR.'/settings/directory.php');
This is calling in a the “directory.php”. This will be used to create created directory constants for all the files you have in your site.

The code inside of this file look a little like this.

// This is to set up the directy list
if(preg_match('/\/$/', $_SERVER['DOCUMENT_ROOT'])) {
define('ROOT_DIR', ($_SERVER['DOCUMENT_ROOT']));
} else {
define('ROOT_DIR', ($_SERVER['DOCUMENT_ROOT']).'/');
}

//All things in the root directy
// How To Use "echo Main_DIR;"
if(!defined('Main_DIR')) define('Main_DIR', ROOT_DIR.'proclarush/');
if(!defined('BLOG_DIR')) define('BLOG_DIR', ROOT_DIR.'blog/');
if(!defined('Cache_DIR')) define('Cache_DIR', ROOT_DIR.'cache/');
if(!defined('PLUGIN_DIR')) define('PLUGIN_DIR', Main_DIR.'plugin/');
if(!defined('SITEMAP_DIR')) define('SITEMAP_DIR', ROOT_DIR.'sitemap/');
if(!defined('WIKI_DIR')) define('WIKI_DIR', ROOT_DIR.'wiki/');

//Main Folders in Proclarush
if(!defined('CONTENT_DIR')) define('CONTENT_DIR', Main_DIR.'content/');

Now you might be asking why is this a good idea? Lets say this is how things are laid out on you site to get to an image.
yoursite.com/content/contact/form/image/a_nice_image.png
And you coded it something like this.

<"show" img alt="nice image" src="

Now say this is your FORM_IMG_DIR

define('FORM_IMG_DIR', ROOT_DIR.'/content/contact/form/image/');

Now was you just want to move that image to the folder with the rest of your images. well if you have a large site you may have a lot of images to relink. But if you do it this way you will just have to change that link in one place.
So change this:

define('FORM_IMG_DIR', ROOT_DIR.'/content/contact/form/image/');

To this:

define('FORM_IMG_DIR', ROOT_DIR.'/image/');

And thats it.

Now line 3:
include_once(Main_DIR.'/settings/settings.php');
Now this is going to be information that you will need over and over again.
Lets use four common things that you will use in a site.
Name:
Email:
Address:
Link to blog:

Well if the client ask you three months after the site is done to change her email address it could be a pain to remember where all that email address in. That is where this comes in.

The code will look a little like this.

$ClientName = "James Riter"
$ClientEmail = "chaos67731@gmail.com"
$ClientAddresse = "Hot As Hell Las Vegas"
$ClientBlog = "Jamesriter.com/blog"

Now every time you want my name or email in the site you can do this.

and changing my name from James to Jane only has to be done in one spot see that your client was a girl.

Line 4:
include_once(SKINS_DIR. 'base_skin.php');

Rite here I am including what I call the base skin, This file for me holds a lot of basics to the site but at the same site it does not really hold much. Just like the index.php you should call in a lot the this page to it clean and easy to work with.

Well I was going to set up a few files to download but it is getting late. If you want some and I have not added any yet just let me know and I will send something your way.

You can view my CMS at http://proclarush.jamesriter.com/

Rite now I am on V1 and am starting to learn about MVC so will be updating as soon as I got time.

Now time I will cover
1: Building a nav
2:Pulling in content
3:What I put in my CSS