Conversion to Classes
15, Nov 2008
Not much new from the front end view, but I'm in the process of converting the entire site to run off of classes. Prior to this, I had done some experimentations with PHP classes, but never actually sat down and figured out how they really worked. So, in the spirit of what I hope this site will become, I'm trying it out here. I've already converted the blog system to run on a class, and I really like how it has streamlined my code.
Before doing this, I had everything that ran the site stuffed into the actual pages that they applied to, often times making it ridiculously hard to find a specific section if I needed to make changes to that area. Also, the logical flow of the page structures were not consistent, dependant on nothing more than how I was thinking at the time that page was constructed. In addition to all of those problems, I had many more pages than were actually needed. Because I had no consistent structure that I could use to run things, I had at some time or another, gotten into the habit of creating a page for nearly every action, so I would have an edit_post.php, a delete_post.php, a save_post.php, etc.
Now, that I've moved over to a class based system, things have compacted drastically. I still probably have near the same amount of files -I've also started using external .html files as templates to create all the actual page layouts. I'll talk a bit more about that again at a later date. However, the site makes much more sense in it's structure and relationships to other files. One interesting fact that has come of the class conversion: My home page is now 19 lines of code.
I'm currently working on converting the administrator back end to run off a class structure. At the same time, I'm also adding some new features and options to the posting abilities. Some planned (and necessary) additions:
- A coherent mark-up system that will allow me to format the posts to be output with valid XHTML
- An image uploading and resizing function
- A way of posting example code to the blog
- More options on publishing schedules
- Plus an all around prettier admin control panel. At the moment, it is rather sparse.
As soon as that's done and I'm able to start posting code examples up here, I'll start a more detailed run-down of how I've created this site.
Have Something to Say?
Questions? Comments? Concerns? Let me know what you’re thinking.