How to Break Your Site In One Easy Step


The MistakeWe all make mistakes. My mistake was not understanding the code behind the categories sections that my site uses…

The Mistake
We all make mistakes. My mistake was not understanding the code behind the categories sections that my site uses. What I wanted to do was create a new category called ďWritingĒ that I could log my NaNoWriMo entries to. It seemed simple enough. I went into the category administration section and created a new one. My mistake was wanting to reuse the news picture. It was late at night and I was in a hurry to get to bed. In my hast I forgot that the program links the picture and category name together. Worse, I didnít even realize Iíd done something wrong.

The Discovery
Yesterday, after I posted my latest ZX81 article I noticed a bit of an oddity. When I looked at the next two articles, I noticed that the program had listed the same article twice. The post was from earlier in the month and didn't look right, so I started to dig. I pulled up the topics list, the file that drives the front page article list, and discovered the double entry as well as a several missing past articles. At this point, I realized I must have done something wrong and started digging further.

The CMS I use drives the category list from a file based on its name. I pulled up the news file and it only had a single article listed in it. I knew that was wrong because the news file should have a number of articles I've added to it over the years. Perplexed I tried to bring up the writing category. Wait, there wasn't one. Then I remembered my earlier decision to use the news category's picture. Instead of picking a creating a new category called "Writing" with the same picture as the news category, I'd actually used the same news file twice with two different category names. The program didn't know how to deal with this, nor did it prevent it from occurring. At this point, I realized I made a serious mistake.

The Fix
My first attempt to fix was to to use the program's category mangement interface to edit the list. If you didnít know, Iím using an older version of Web-App.net to run my site. I choose it years ago because Iím a heavy Perl developer. Web-App.net was a good fit as I could add plug-ins and themes in a language I was comfortable with, yet the site was full featured and provided a nice base to work from. Perfect for a weekend project and ran generally. The one area that it falls short is in category management. When I went to fix the category, I realized that it didn't work the way I expected it to. I skipped the web front end and just edited the file.

The next problem I faced was moving articles back into the right categories. When I tried to move missing articles into the files it didnít work. I figured out that the program drives the article list from the category files. If the article isnít in the file, it doesnít really exist. I was back to editing files. This poses a problem because if a topic isn't in one of those files, the CMS won't display it. Fortunately, I had an old copy of the news file. Although a good start, and I was able to fix the missing newer articles, I was still missing quite a few topics. No big deal, I thought, Iíll just pull up the full article list. If the article didn't show in the list, I knew that it was the one I needed to add back.

Then I ran into another problem. As you create an article the program adds a number to identify it. However, the function that lists the articles sorted the articles by the category they're in, not by their number. Nice, I get to program again. I edited the routine to sort the list the way I wanted it to and, after a few tests, had a nice list of articles. Sure, it would have been easier to just list the topics not in an a category. unfortunately, that would have required a lot more effort. I opted for the more direct approach, just searching the list for missing numbers. After a few minutes of cutting and pasting I had my site back to normal. Mistake corrected.

The Future
There are still a number of issues with the CMS Iím using. Itís old, not even the latest version. I never upgraded because the newer version added features I really didnít want. That means that I bound to run into a bug sooner or later. My investigation of the category problem made me think that the structure isnít well suited for blogging. That said, it has worked well for a number of years and I really havenít wanted to put in the time to build a new one. Iím still playing with WordPress and other blogging systems, but havenít found the right features yet.

For now, I think Iím just going to stick with writing articles and working on other projects. Eventually Iíll make a decision to move to something else, but until then Iíll just have to live with a few bugs. The moral of this story is donít cut corners.

Now where was I at in my novel?



Comments on this article:

No comments so far.

Write a comment:

Type The Letters You See.
[captcha image][captcha image][captcha image][captcha image][captcha image][captcha image]
not case sensitive