Hello friends today’s tutorial is all about Create CMS Using PHP.  CMS stands for Content Management System. CMS is very useful for creating Blog or Website. Basically CMS is used for managing content dynamically. CMS is used widely and many CMS are already there in the market like WordPress, Drupal, Joomla etc they are big and having many features which we dont want in our application or website. So we create our CMS according to our need. In this tutorial we will create the CMS using PHP with SEO Friendly URLs.

In this tutorial We will create front end and admin end so we will start with the Admin end first.

Admin Panel

  1. Dashboard (dashboard.php)
  2. Add Page (add-page.php)
  3. Edit Page (edit-page.php)
  4. Manage Page (manage-page.php)
  5. Login Page (index.php)

Admin Panel Directory Structure

  1. admin
    • functions (Directory)
      • connectionClass.php
      • gump.class.php
    • inc (Directory)
      • header
    • login (Directory)
      • loginClass.php
    • messages (Directory)
      • alertClass.php
    • pages (Directory)
      • pageClass.php
    • add-pages.php
    • dashboard.php
    • edit-pages.php
    • index.php
    • logout.php
    • manage-pages.php

 

Front End

  1. Index Page (index.php)

Lets start with Step by Step.  First we will start with creating the login script with login page.

Login Page (index.php)



Above code will create a login window. We use the username and password for login. After clicking submit we will go for checking the submitted values.

Username – admin

Password – demo

loginClass.php – We will use this class for check login and save the session values for maintaining the login.

In the above code first we will sanitize the values using the mysqli_real_escape_string function.  After getting the values we will first check the Username if we will find it than we will move for checking the password. If everything goes perfect than we will save the values to session and redirect the page to the Dashboard.php.

Dashboard (dashboard.php)

This page is just a welcome page and for showing the counting of how many pages you have added. This page will come when you successfully login.

 Add Page (add-page.php)

We will use this page to add new pages to our website. In this we have use some text boxes so that it will helpful for us to enter the data to the database.

We have used the summernote as editor for adding the page details.

We have used the gump class so that we will validate the form before submitting the form.

Manage Page (manage-page.php)

This page will list all the added pages for edit and delete. This page will show the data in table format.



Edit Page (edit-page.php)

Edit page will work same as add page it will just take the values from Get global variable and show the values in the text boxes. When you click on the update it will update the current data.

Delete Page

Deletion of page is available at the manage-page.php. In the Action column you will find a link named Delete. When you press the button you will see a warning for confirmation if you press “Yes” It will delete the page.

 

Front End

As you can see We have created the Login page, Add page, Edit page, Manage Page, Delete Page functions. Now we will move to our Website Front end. Its so simple and easy. You have to just show the data from the Database using the Page Class.

We will call all the pages over the index.php and show the details according to the pages clicked. Here we can call the data by using 2 types. 1 Calling by Id 2. Calling by URL.

Calling by id will work if we use the page links as Id in our navigation like-

But this is not the approach we are using. We are working over the SEO Friendly URLs and this is not the Seo friendly at all. So we will change the ID to the URL and remove the index.php from the URL. Our Navigation will look like this than.

For doing this we will create a .htaccess file with some lines of code

.htaccess

First be sure that rewrite is enable in your server otherwise it will not work. We have used the RewriteBase as /cms/ you can use anything here you want but it should be the name of your Folder like i am having –  http://tutorials.vivekmoyal.in/cms/what-is-lorem-ipsum

If you dont have any folder than you can remove it also. Now here is our website index.php page for showing all the information.

index.php

We are using a function  - particularPageSlug($pageList[0]['URL']). This function will take the data from the database based on the url parameter value. You must be missing some files here so you can download it form our my Github repository.

Download From Here

Demo

 

5 Comments

  1. Hi,
    congratulations !

    i downloaded the code but i didn’t find de database structure,
    can you send it to me, please ?

    many thanks.

  2. will you post the SQL for this project?

  3. I liked your cms but in the archive I found the sample Database.
    Thank you!

Leave a Reply

Your email address will not be published.

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">

© 2017 VivekMoyal

Up ↑

Shares