SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Enthusiast Dolbex's Avatar
    Join Date
    Jun 2003
    Location
    Confused USA
    Posts
    70
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Related Articles

    I am currently developing a site that has some very cool customization features for both my users and for my non-web-savy admins. One thing that has me a little stumped is the best way to do "related articles". News and feature articles is a large chunk of this site, and I would like to display to the end user related articles to the article they are currently reading... Anyone know the best way to do this?

  2. #2
    SitePoint Wizard
    Join Date
    Jan 2004
    Location
    3rd rock from the sun
    Posts
    1,005
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    How are they related?

    by a category?
    by shared keywords?
    in your admin users head?
    or just in your head?

  3. #3
    SitePoint Addict bkennedy's Avatar
    Join Date
    Aug 2004
    Location
    michigan
    Posts
    251
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if you have a DB entry for each article, add a field to it for "related_id"
    then, make a table that has two fields: an article id and related_id
    if you want to relate article 1 to article 2, you'd add two records in that table, one for article 1, one for article 2, and they share the related_id.
    so what you'll end up with is "pools" of articles for each related id.
    to find articles related to the one you're reading, you'd get it's related_id from the main table, then go to you related article table, fetch the id's of the articles with the same related_id, then go back to your main table and retrieve the data for those articles
    ----------------
    bob.kennedy
    ----------------

  4. #4
    SitePoint Wizard
    Join Date
    Jan 2004
    Location
    3rd rock from the sun
    Posts
    1,005
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ...for both my users and for my non-web-savy admins
    Now you need to make these people associate old articles with new ones.

    Do your articles belong to "categories" or "headings"? or is it just a free for all?

  5. #5
    SitePoint Enthusiast Dolbex's Avatar
    Join Date
    Jun 2003
    Location
    Confused USA
    Posts
    70
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    They do belong to a "topicid" that will associate it as far as a topic goes. However, what I had in mind was a list of related checkboxes that would allow the writer to narrow the articles down a bit. For instance... lets say this web site was about cows....

    So, they input the title, the topic (category), and the body of the story. Along with that they have a list of checkboxes like:

    Milking
    Hearding
    Feeding
    Butchering
    Clothing
    Illnesses
    Pasturizing
    Slaughtering (grody)
    Bulls
    Bull Riding
    Cow Tipping (im running out of ideas for this example)

    ... and on and on with maybe 15 different checkboxes. This would allow the writer to specify exactly what the article is related to within that topic by selecting multiple checkboxes. I really don't know.. maybe this is a bit too much.. but we are posting about 5 individual articles a day at this point and with it likely to increase, I would like to increase the efficiency of the related articles past "topic"... any good ideas?

    BTW.. to answer pauly's question.. yea.. keywords would be the avenue I am heading.. multiple ones...

  6. #6
    SitePoint Wizard
    Join Date
    Jan 2004
    Location
    3rd rock from the sun
    Posts
    1,005
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    In effect you would likely then use bkennedys idea, the checkboxes could be a list of common "keywords" from an "extendable vocabulary", that you would need to "seed" to get it started.

    These "keywords" you would keep in another table.

    Now, where this can fall down is that your authors cant be bothered (dont have time?) to select the correct keywords. So, when the article is submitted you could parse the string looking for keywords that are already found in that article, and pop up another screen saying "are these these apt keywords?" {list found keywords} and then allow them to unclick those that don't apply.

    Let them add new keywords to the "shared vocabulary", optionally.

    That'd be smart.

    so you'd end up with: a table of keywords
    +---------+---------+
    keyword_id | keyword
    +---------+---------+
    eg= 27 | "hoof"

    And a table of keyword associations,
    +---------+-----------+
    article_ID | keyword_id |
    +---------+-----------+
    23 | 27


    Which, as I say is another take on what bkennedy suggested.

    I could rave on about this subject if you like, but this might give you an idea.

    Gd Luck

  7. #7
    SitePoint Enthusiast Dolbex's Avatar
    Join Date
    Jun 2003
    Location
    Confused USA
    Posts
    70
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, I think I follow. Yea, sounds like a great idea. However, how would I go about populating the keywords table? Would I just go through and enter a bunch of words that I think apply and then leave it at that? Is there any way to pull words from the story intellegently to allow the list to evolve?

    Also, I guess the way I would search the string for the keywords would be like this:

    Code:
    $bigolarray = results from keywords table
    
    for ($i=0; $i<mysql_num_rows($result); $i++)
    {
       if(strpos($storygoodness, $bigolarray[$i]) >= 0)
          word listed initially to writer
    }
    Eh?

    Also, as far as the sql goes on the front end when querying out the ones that have the most in common.. is there a simple way to query out the articleid's that have at least 3 common keywordid's in common? Im not breaking any records in the SQL efficiency column... something I am definitly trying to improve on.

  8. #8
    SitePoint Wizard
    Join Date
    Jan 2004
    Location
    3rd rock from the sun
    Posts
    1,005
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    how would I go about populating the keywords table? Would I just go through and enter a bunch of words that I think apply and then leave it at that?
    I guess there could be as many steps as you wanted, but,

    1) yes, adding the words yourself is a start, and you know it'll work!

    2) Then try and get your users to collaborate, and add "new keywords" - provide them with the means of course

    3) Then, in time, try and autosuggest keywords.

    There are ways of doing this, read up on mysql "Full Text" slows up your saves but speeds up your searches.
    Now this is where I am into theory only...
    There is a way of listing all "noise words" "the" "and" etc, rip them out (maybe thats what full text does)
    Then find the words stubs "hoofing", "hoofs" becomes "hoof" - then try and list them - you could do that for your own use (to pre-select keywords) - but the best is probably to "help and remind" your authors, kinda..

    ======== e.g. =====================
    Thanks for adding that article, your support is appreciated.

    Help our readers find your article, which "keywords" could be used to describe this article;
    1) [here you list keywords that resemble words in your CATEGORIES]
    [ ] checkbox
    2) In this article you used these words
    [ x ] "hoof" 4 times
    [ x ] "****" twice
    [ x ] "kick" once
    =======================

    The knowledge to do that stuff exists, for PHP/mysql, its just a matter of finding it, in time eh?

    btw something else I am going to apply is this I saw in wikepedia:
    When you search for the term "pdf" a page asks you which kind of pdf you mean, page called "disambiguation", you may not need that as your site seems quite bovine specific! Take a butchers anyway:
    http://en.wikipedia.org/wiki/PDF_%28disambiguation%29
    Last edited by paulyG; Oct 10, 2005 at 12:25. Reason: jolly good profanity filter


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •