How to create a blog in PHP and MySQL database

 I'm excited to be taking you through this long awaited tutorial, finally. I'll show you ways to create an entire blog application from scratch using PHP and MySQL databases. A blog as you recognize it's an application where some users (Admin users) can create, edit, update and publish articles to form them available within the public to read and perhaps discuss . Users and therefore the public can flick through a catalog of those articles and click on to anyone to read more about the article and discuss them.


Features:


A user registration system that manages two sorts of users: Admin and Normal Users

The blog will have an admin area and a public area break away one another

The admin area are going to be accessible only to logged in admin users and therefore therefore the public area to the traditional users and the general public

In the admin section, two sorts of admins exist:

Admin:

Can create, view, update, publish/unpublish and delete ANY post.

Can also create, view, update and delete topics.

An Admin user (and only an Admin user) can create another admin user or Author

Can view, update and delete other admin users


Author:


Can create, view, update and delete only posts created by themselves

They cannot publish a post. All publishing of posts is completed by the Admin user.

Only published posts are displayed within the public area for viewing

Each post is made under a specific topic

A many-to-many relationship exists between posts and topics.

The public page lists posts; each post displayed with a featured image, author, and date of creation.

The user can flick through all posts listings under a specific topic by clicking on the subject

When a user clicks on a post, they will view the complete post and comment at rock bottom of the posts.

A Disqus commenting system is implemented which allows users to comment using social media accounts with platforms like Facebook, GooglePlus, Twitter.


We'll call the project complete-blog-php. On your server directory (htdocs or www), create a folder named complete-blog-php. Open this folder during a text editor of your choice, for instance , Sublime Text. Create the subsequent subfolders inside it: admin, includes, and static.


The 3 folders will hold the subsequent contents:


admin: Will hold files for the admin backend area. Files concerned with creating, viewing, updating and deleting posts, topics, users.

includes: Will hold files containing pieces of code which will be included into one or more other pages. E.g. Files for error display

static: Hold static files like images, CSS stylesheets, Javascript.


Between the <head></head> tags, we've included links to some Google Fonts. There's also a link to our styling file public_styling.css, which we'll create during a minute.


Notice also the element with a category set to container that wrap our entire application including the navbar, page content and footer sections of the page.


To view this in your browser, attend http://localhost/complete-blog-php/index.php.


Doesn't look as cool as you would've loved right?


The static folder as stated earlier will hold, among other things, styling for the location . Create 3 subfolders inside a static folder: css, images, js. within the css subfolder you only created, create a file named public_styling.css.


Reload the page within the browser. Our simple page now features a pretty navbar with a logo, some beautiful fonts, and, if you scroll down, our footer is hiding somewhere at rock bottom . Great!


Our page, however, features a few code segments which will be repeated across many other pages of the web site . As an example , most pages will need a navbar and therefore the footer also because the links to the styling and fonts that are within the head section. In learn PHP online, we will write a bit of code in one file and include it at a specific position in several other files. this is often equivalent to writing that very same code in those locations but with the advantage that it prevents repetition of code. We do that using the include or require keywords.


As you'll have already guessed, it's time to make use of our includes folder we created at the start . The sections that are repeating are the top section, the navbar, and therefore the footer. So in your includes folder, create 3 files namely head_section.php, navbar.php and footer.php.


Comments

Popular posts from this blog

Full Stack Course In Jodhpur | Oilab

Php Course In Jodhpur | Php Training In Jodhpur | Oilab Learning