Re: searching by tags....
| From: | Nathan Rixham | Date: | Tue, 14 Oct 2008 21:59:51 +0000 |
| Subject: | Re: searching by tags.... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-281923@lists.php.net to get a copy of this message | ||
Ryan S wrote:
Hey, this the first time I am actually working with "tags" but it seems quite popular and am adding it on a clients requests. By tags I mean something like wordpress' implementation of it, for example when an author writes an article on babies the tags might be baby,babies, new borns, cribs, nappies or a picture of a baby can have the tags baby,babies, new born, cute kid, nappies the tags are comma separated above of course. The way i am doing it right now is i have sayyyy an article or a pic saved in the db as article_or_pic_address text the_tags varchar(240) My question is, when someone clicks on any one of the tags, do i do a LIKE %search_term% search or...??? quite a few sites seem to have a very neat way of implementing this with (url rewriting?) something like http://sitename/blog/tags/tag-comes-here/ Any help in the form of advise, code or links would be appreciated. TIA. Cheers! Ryan ------ - The faulty interface lies between the chair and the keyboard. - Creativity is great, but plagiarism is faster! - Smile, everyone loves a moron. :-)you need to normalise you're db mate table: tags tagId int autoinc tagString varchar(200) table tags_ref tagId (from above) objectId (id of what you want to link the tag too) that way you can simply join up the 3 tables and select from tags_ref where tagId=XXX to get all the objects (post, link, image, video etc) that the tag is associated to. (and allow much more functionality)