Creating this Post

Created on 2017-03-25 08:34:21

Motivation

I have decided to write blog posts again. I intend for this site to be living proof of what I can develop, so using Wordpress is not an option here. Therefore, I am building up a blog post system of my own. I am an agile developer, so features will happen in iterations, but I eventually plan to have a full-featured system.

First Steps

I started with an admin section. This could be .htaccess protected, but I decided to make a nice login screen. This requires saving a user and a hashed password then comparing those values with the input from the login form. I am not going to tell you how I did all that for security's sake, but it is easy to either store the user in a DB or in a file. The important part is to make the comparison hash use the same encryption method and salt as the stored password.

Admin Area

Now that we are authenticated, we can start to do stuff. I already had a table for skills and favorite things, so I added some forms in order to perform CRUD on those. I decided on MySQL and, just for the hell of it, the MeekroDB php library. Most normal people would use PDO, but I decided to see what Meekro was about. Once I had the DB connected and the basics of the existing tables in place, it was pretty easy to define a blog post table with the basic fields I care about. For formatting, I dropped in TinyMCE. Now I can make fancy blog posts without relying on Wordpress.

Display

I updated the home page to pull in the latest blog posts with a limit of 10, and also link to a page where I display all the blog posts. The post titles are linked to a view page where the full blog post is displayed. These are really simple views to throw together. I will be implementing some rewrite rules to make the urls a bit fancier and implement a "slug" feature for friendlier titles. When I actually write enough posts to need pagination, I will be adding that as well. I may add tags at some point, and some form of comment system like disqus or facebook comments or something. I am not sure I want to deal with actual user logins and all the spam.

Next Steps

I am going to blogging as often as family and work will allow. As I post more and run across issues, I will be tweaking the blog scripts and the site in general. I am in the middle of creating an API that will replace a lot of the php forms and go with a more SPA approach. This in turn will give me more to blog about, so hopefully I will continue the momentum this time around.