Why I’m Building My Own Site

I should preface this post by saying that this will be the first of many very nerdy posts. This site isn’t completely done because I’m building it from scratch using CodeIgniter. By programming the site myself, I can make exactly what I want and hopefully apply it to future projects. I will be documenting some of my bigger A-HA! moments here on the blog. You have been warned.

I want to hone my skills as a programmer, but the truth is: every off-the-shelf CMS out there tends to be overkill for what I want to do or is too blog-centric. In the case of my portfolio, I want a CMS that presents me with a place to put my description and a place to put files, and be done with it. Another CMS would require me to shoehorn how I want my portfolio to appear into a template that I have to fill out, and then that content becomes harder to reuse later. That’s why I have a portfolio controller and a portfolio model in CodeIgniter, as well as separate portfolio and files tables in the database. I could completely redesign the portfolio section a year from now and not worry about having to change any of the content.

This weekend, I found myself needing to bend CodeIgniter to my will. That I was actually able to showed me how much I like its malleability over other frameworks.

I created a new pages database for all of that static content that every site has, like the About ARLOdesign® page. I created a page controller, put the code to pull the appropriate page in the index function, and then made a route:

$route['about'] = ‘page/index/about’;

That worked dandy, but it got me thinking: What if I add a new page? Does that mean I have to add a new route every time? I can’t expect another user who might want to use my application to edit their own routes; that’d be silly. Shouldn’t everything be a page unless I specifically create a controller to do something special? Wouldn’t it make more sense if:

  1. CodeIgniter checks to see if a controller exists.
  2. If a controller doesn’t exist, send the request to the page controller.
  3. If the requested page doesn’t exist, send a 404 message.

It took awhile, but I ultimately came up with the solution.

Obviously, CodeIgniter has to see if a controller exists: it’s in the Router.php library. I found this post. Now I have MY_Router.php sending requests to the page controller with:

return array('page', 'index', $segments[0]);

Problem solved, right? Except for one caveat: I wanted a custom 404 page, and I wanted that page content to also be editable from the pages database table. Now it gets fun. It was easy to have page controller return the 404 page if the database query returned zero results, but what about the portfolio controller? I can’t just redirect the user to a 404 page because the URL in the browser would change, preventing the user from saying, “Oh, there’s a typo” or something.

Ultimately, the answer was to create MY_Exceptions.php and extend the show_404 function. I copied my code from the page controller and loaded the 404 page. Sure, there’s probably a better way than having to copy and paste code like that, but it seemed like a great, quick hack to accomplish what I needed. It also required an even uglier hack to actually display the views, invoking the output class manually. It worked, but I think it can be improved. UPDATE: It became a library.

The point of all this: I learned more about how my site will operate than I did before. I learned some new skills, and I have more to be proud of on this site than just the content. That’s pretty damn satisfying. That’s why I’m building my own site: because when it’s exactly what I want it to be, it means I learned a lot on the way.

FYI: The blog is running in WordPress, but that’s temporary. I seriously plan to replace it, as WordPress really is more than I need.

The Site Finishes Kindergarten

I’m anxious to start writing about things other than updating you on the development of the site. However, some major hurdles have been overcome, and I can finally take that strikethrough off of the Portfolio link. Descriptions need to be written. Pieces still need to be photographed. My code needs more error checking. I liken the site right now to a student finishing Kindergarten — it can count to ten and use words to express feelings but still occasionally wets the bed.

A seasoned programmer would have had this done months ago, I know. Considering that I’ve built websites with database backends before, my wife also figured I would have had this done months ago. However, I’m a novice at best. This time, I wanted to to it right. I have PHP.net, jQuery.com, the CodeIgniter user guide and forums, and Google all open on any given Sunday.

The truth is, writing code is a leisure activity for me. Some people do crossword puzzles; I write MySQL queries. When real heavy lifting needs to be done, I leave it to the professionals.

More to come soon. And this week, I might even write about something else. How novel.

I ♥ the Future

There’s a lot of crossed out links over there on the left. I’m sure it is with great sadness that you have clicked those links, only to find yourself back where you started.

Rest assured those links are getting populated. And they’re gonna be fancy.

In the meantime, those of you who have arrived looking for some information about me and what I can do, here’s my resume and some samples of my work (both are PDFs):

Work Samples

Thanks for your patience, and pardon our dust, and blah-blah-blah. Trust me: by the end of this month, this site will be resplendent.

A Messy, Painful Birth

Perhaps that’s the wrong note on which to kick off my new website, but it’s the truth. At least I have nowhere to go but up.

I committed to the May 1 Reboot. I didn’t get as far as I would like. The sidebar is a mess and the portfolio section isn’t done.

At least my new design is here for the world to see, though. I’ve only seen a few actual ugly babies in my life. Mostly, they’re adorable. Next thing you know, they’re adults. They grow up so fast, y’know.

I had originally titled this post “Fail.” But as I wrote, I realized that this isn’t a failure after all. Babies enter this world covered in goo and confused, so perhaps launching this new site in such an incomplete state really is the most appropriate way to go about it. Like most parents, I’m not sure what direction this is going to go in. My last blog went in directions I never dreamed of. The new ARLOdesign, just now opening its eyes, may not know everything it needs to know yet about navigating the world, but at least it has ten fingers and ten toes.

To the few of you who have stopped by to peer through the glass and see the little blue knit cap wrapped around this new site’s bald little head, welcome. It’s great to be alive.

(This site has so far only been tested in Safari and Firefox 2. I’ve glanced at it in IE7 and seems okay, but I’m pretty sure IE6 is a total mess. Don’t worry—it’s all on the list.)