views:

28

answers:

1

i am wondering how are plugins like Disqus developed. they are like tagged to a URL (but abit more advanced, as they have to work with say different query strings, server side language, use of short urls etc).

i want to ask this as i feel that it is a good idea to keep separate functionality like comments/ratings/reviews in separate components and plugged in as needed so functionality can be attached dynamically.

eg. blog entries are comment-able and so is a portfolio image, but a blog entry may not be reviewed like a portfolio image might

update: i will be using PHP/MySQL, but i guess such a "pattern" can be implemented in any language

+1  A: 

Looks like no one is willing to answer your question. Well... Recently I developed a comment system similar to your desired one. I'll try to explain how I achieved that. (and you should be able to work reviews/anything else out from that one too).

Main site keeps variables such as: current used component (say module/plugin/whatever), loaded item identificator (if any).
Then there's this comments class, it's loaded by default, but runs only it's function, let's say check, which checks if current loaded component @ identificator has comments enabled or not (MySQL stores it for me). If yes, then you build that comments form.

#example (component) table:
id (item_identificator) | comments | title | content | author | timestamp | <etc.>

My comments table then stores form variables along with component and item_identificator.

#comments table:
id | component (in this case - "example") | item_identificator | comment | author | timestamp | <etc.> 

And, to show those comments you just load comments from database where component and item_identificator is equal with current used.

I hope you understood! And because you haven't specified any language tags, I allowed myself to write about PHP and MySQL.

If you got any questions, feel free to ask.

EDIT

Just read what Disqus is, well... This won't be cross site. :(

Tom
i am using PHP/MySQL, thank you for taking time to explain this to me. i think this is 1 option i will explore
jiewmeng