Page 1 of 1

Removing blog tags: my approach & your thoughts please?

Posted: Wed May 13, 2009 4:28 pm
by JAB Creations
Earlier today in the midst of Florida death-strike thunderstorms I finally got around to and got working tags on my blog. Most of the infrastructure (err code) was already in place thankfully. I just had to create an INSERT query for the blog thread/tag id relational table. It's funny how if you walk away from something but still use the same language you passively become better at finishing a project that you've procrastinated about. Well any way I realized that, 'Hey, I need to be able to remove tags the same way I add them!'

So here is my point to point idea of how to approach it and I'm curious as to people's reactions and thoughts? I'm aiming for modestly efficient here since editing blog tags isn't something that will happen save once every few days any way.

1.) Get array of previous tags (submitted with form as hidden input).
2.) Compare to array of current tags to previous tags.
3.) Create new array of expired tags (that were in the old tag array but no longer found in the new tag array).
4.) Do foreach for removing tags in the expired tag array.

I figured by sending duplicating the tag array a second time from a single query I could avoid an unnecessary SELECT query (or queries even) to figure out what tags needed to be removed.

I'm working on all of this now and in to the evening though I'm interested in any related thoughts. :)