Re: Re: searching by tags....

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 2008-10-19 at 16:34 +0200, Martin Zvarík wrote:
> Ryan S napsal(a):
> > 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. :-)
> > 
> > 
> > 
> 
> The main point here is WHAT SHOULD BE THE BEST DB STRUCTURE.
> 
> I got this feeling, from what I've read, that everybody wants to express 
> themselves so much, that they talk about something they know at least a 
> little about = SEO.
> 
> To the TOPIC: I think normalization would be a killer.
> Imagine joining 3 tables (I really don't see more functionality here) OR 
> just selecting from 1.
> 
I think the reason we all got off topic here was because URL rewriting
was part of your original question.

As to your other question, I think that the best idea is to have a
separate table for the "tags", and link them to the unique id of the row
on the main table that contains the content. This way, searching for
specific tags, and producing counts (for weighting individual tags) is
an absolute doddle, and can be done with pure SQL rather than retrieving
all the information from the database and have PHP do the donkey work.


Ash
www.ashleysheridan.co.uk


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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux