A question for the more technically minded among ye. I'm going to be doing some work on a database of local information for inranelagh.com, and I'm think about how to structure it. At present, I'll want to flag entries in the database with various notes, and also attach tags to them, in the short-established Web2.0 style. Since there'll be an arbitrary number of possible tags for a given entry, and an occasionally changing number of flags, what's the best way to manage this?
Possibilities in my mind is to have one field, "flags", containing a comma separated list of words, and the same for tags. Another possibility is to have a field per flag, and let them be 1 or 0 - although I can't see that working for the tags. And finally, there's the possibility of a table co-relating flags/tags and entries separately.
I might just use tags overall, but I'd like to distinguish between the ones I set (flags) and the ones anyone else sets.
And a separate question - does anyone know how easy it is to get at phpBB's user storage, and if that login could be used elsewhere on the site, for comments, feedback, submissions, and the like?
I'm in an odd place on this; I know the stuff that can be done, I work with it every day, but in many ways, I haven't the slightest idea how to go about it anymore without developer support.
Possibilities in my mind is to have one field, "flags", containing a comma separated list of words, and the same for tags. Another possibility is to have a field per flag, and let them be 1 or 0 - although I can't see that working for the tags. And finally, there's the possibility of a table co-relating flags/tags and entries separately.
I might just use tags overall, but I'd like to distinguish between the ones I set (flags) and the ones anyone else sets.
And a separate question - does anyone know how easy it is to get at phpBB's user storage, and if that login could be used elsewhere on the site, for comments, feedback, submissions, and the like?
I'm in an odd place on this; I know the stuff that can be done, I work with it every day, but in many ways, I haven't the slightest idea how to go about it anymore without developer support.
Tags:
From:
no subject
All of this is based on the assumption that you're using a SQLish relational database, but here's how I'd do it:
First, I'll assume your base table looks something like this:
Notes go into another table referencing the base record.
If you really want to normalize your tags, you need two additional tables. First, the tags themselves have their own table, in an attempt to keep them as consistent as possible. Then you need another table to cross-reference the tags back to the original record.
Then it's easy to query all notes for a given record:
SELECT * FROM RecordNotes WHERE record_id = @record_idOr all the records tagged with your flags:
SELECT Records.* FROM RecordsINNER JOIN RecordTagXref ON Records.record_id = RecordTagXref.record_id
INNER JOIN Tags ON RecordTagXref.tag_id = Tags.tag_id
WHERE Tags.is_flag = True
...or whatever else you need.
From:
no subject