Last time, I put together the basic HTML of the simple blog. Today I’m going to work out the interchanges.
When a user first comes to the simpleblog index page, they’ll be presented with a list of the ten most recent entries, a login form, and buttons to display the next ten or previous ten entries chronologically.
So the first thing that has to happen is that the page must ask the controller for the ten most recent blog entries. This means the controller must ask the model for the ten most recent blog entries, to share them with the view, the page.
If the user enters data in the login form and presses the login button, the page must give that data to the controller to compare it with the login data in the MySQL database. I’ll enter that data directly, since it’s a one person blog. So there’ll need to be a model for the login database as well, and functions to access it.
When a user successfully logs into the blog, a persistant field will be created so that the user stays logged in. The sidebar will also be changed to include post and logout buttons via a script, and hide the login form.
When a user is logged in, each post will include edit and delete buttons. Edit will bring up a version of the post page with the data from that post. Delete will bring up a dialog box to confirm, then on confirmation will delete the post.
The post button will bring the user to the post page to allow them to post a new entry.
The Post Page itself will be a simple form with a post button. If the post page is shown in edit mode, it will say confirm edit instead. The post button will create a new post in post mode, or save the changes to a post in edit mode.
In edit mode, the Post page will load a previous post, so there will need to be a function for that in the controller and model, and a function to save over the post.
That should be everything. If I’m missing anything it’ll be discovered along the way.
Now I’m going to bed. It’s been a long day but I’m glad I found time to work on this.