At 11:40 AM -0400 3/20/10, Jason Pruim wrote:
I know you are all probably thinking "What does this have to do with PHP?" and in reality... It's probably stretching it a little bit... BUT I am in the process of writing a blog software (Yes I'm aware of all the open source, and paid stuff out there... I'm doing this to learn :)) I am looking at adding "categories" to my blog posts so I can organize my drivel into something that looks somewhat professional, or at the very least, organized so you can filter out all the crap...

What I'm wondering about though, is would it be better from a database design stand point to do a database field for "categories" and then in there put "Personal", "Business", "Crap I found funny" Basically 1 database field for all the categories I decide to use. OR should I go the other route and do 1 database field for each category?

This is going to be a small blog to start, but I guess I should always be looking at performance, security, & maintainability right?

I did read the post that tedd put up about looking at storing variables differently and am considering going that route... But just wanted to know what you all think :)

Oh.... I'm also not expecting to have more then 4 or 5 categories at the most.... Unless I release the blog to the public and take wordpress down :P

So any help would be greatly appreciated :)

Thanks yall!

Jason Pruim


Jason:

Basically whatever everyone else said, namely use a table to record every category you may want and that practice provides:

1) Expansion;

You may want to add additional categories and adding it in one table makes sense over adding it to one, or more, selection controls you may have across your web site.

2) Changing the name of any category.

You may find later (after hundreds of blog entires) that the category "Crap I found funny" has just been reviewed by your boss, wife, or mother-in-law and they have demanded that you change it to something more appropriate (according to them). If you used a table, then it's a simple matter to change it over hundred's of post. However, if you didn't, then you have a lot of work to do.

Another consideration.

I have a sort-of blog entry script I add to any page on my site where I want people to comment (see http://sperling.com/examples/new-menuh/ for an example).

The coding to add this feature is a simple one line include statement. The included script looks at the page where it has been placed and creates a space for that page's related comments in the database. After which, whenever that page is loaded, the script calls out the appropriate entries and displays them. The entire process is automagical.

The point I'm trying to express here is one of creating a script that doesn't require any customization for use. This is just food for thought when thinking about how to do this.

Cheers,

tedd

--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to