SitePoint Sponsor

User Tag List

Results 1 to 24 of 24
  1. #1
    SitePoint Guru
    Join Date
    Dec 2000
    Location
    Karachi, Pakistan
    Posts
    913
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    add user comments

    Hello,

    I remember I read somewhere a tutorial on how to add user comments feature to the pages or websites who offers articles and etc. I just forgot how to do it.. and also the tutorial too..

    Can anyone please tell me how can I do it ?? or even refer me to the tutorial which teaches us how to do it...


    Any help is appreciated..


    Regards,
    Omair Haroon
    36Host.com - $36/year web hosting [affiliates earn 30%]
    * Affordable Small Business Web Hosting since 2003! *
    "500mb space, 10gb bandwith, 50 pop/ftp accounts, php,
    mysql, pre-installed php scripts, 24/7 support & more...."



  2. #2
    SitePoint Guru
    Join Date
    Dec 2000
    Location
    Karachi, Pakistan
    Posts
    913
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    anyone.. help me plz.. :(

    anyone ???
    36Host.com - $36/year web hosting [affiliates earn 30%]
    * Affordable Small Business Web Hosting since 2003! *
    "500mb space, 10gb bandwith, 50 pop/ftp accounts, php,
    mysql, pre-installed php scripts, 24/7 support & more...."



  3. #3
    SitePoint Wizard
    Join Date
    Jul 1999
    Location
    Chicago
    Posts
    2,629
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You need to set up a database. On the article display page, check if there are any comments and if so, display them...if not, do nothing. Then put an "Add Comment" form there.

    That's basically how you do it. What language do you want to do this in?

  4. #4
    SitePoint Guru
    Join Date
    Dec 2000
    Location
    Karachi, Pakistan
    Posts
    913
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ASP Ofcourse...

    But what should the table contain and how would it recognize which comments belongs to that article ??
    36Host.com - $36/year web hosting [affiliates earn 30%]
    * Affordable Small Business Web Hosting since 2003! *
    "500mb space, 10gb bandwith, 50 pop/ftp accounts, php,
    mysql, pre-installed php scripts, 24/7 support & more...."



  5. #5
    SitePoint Guru
    Join Date
    Dec 2000
    Location
    Karachi, Pakistan
    Posts
    913
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    anyone ????

    Now that's getting bored..


    Regards,
    Omair Haroon
    36Host.com - $36/year web hosting [affiliates earn 30%]
    * Affordable Small Business Web Hosting since 2003! *
    "500mb space, 10gb bandwith, 50 pop/ftp accounts, php,
    mysql, pre-installed php scripts, 24/7 support & more...."



  6. #6
    SitePoint Wizard
    Join Date
    Jul 1999
    Location
    Chicago
    Posts
    2,629
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The table:
    attached_to_aid
    poster_name
    poster_email
    comment_text
    date_posted

    (Those were copied from my DB table)

    I don't have a user registration system, so I just let people tell me who they are when they write the comment.

    My app executes this query when it's told to display an article:
    select comment_text, date_posted, poster_name, poster_email from comments where attached_to_aid = $AID_FOR_THE_REQUESTED_ARTICLE;

    p.s. Please give me a second to write a reply!

  7. #7
    SitePoint Guru
    Join Date
    Dec 2000
    Location
    Karachi, Pakistan
    Posts
    913
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok..

    I have got an idea..

    Write now I have total three pages in all for articles..

    Page 1 displays the list of the article category.
    Page 2 displays the list of the user requested category's articles.
    Page 3 shows the article..

    Now.. when the user clicks on the category.. the link have a querystring with it.. so the table is ofcourse the same as in the querystring.. and then when it shows the listing of the articles for that subject/category it have a querystring for that article ids and the subject too in the link so the page 3 gets the table name (subject) and the id to pick from..
    now I have an idea. I would post a link like like the below..

    <a href="addcomment.asp?subject=<%request.querystring("subject")%>&id=<%request.querystring%>">Add Comment</a>

    And when I need to display the comments for that article I would do like this..

    <%
    subject=request.quersting("subject")
    id=request.querystring("id")
    sql="select * from comments where subject="&subject&" and id="&id&""
    %>

    and then I would display it.. How is the idea ?? Would it work ??

    Please reply.


    Regards,
    Omair Haroon
    36Host.com - $36/year web hosting [affiliates earn 30%]
    * Affordable Small Business Web Hosting since 2003! *
    "500mb space, 10gb bandwith, 50 pop/ftp accounts, php,
    mysql, pre-installed php scripts, 24/7 support & more...."



  8. #8
    SitePoint Guru
    Join Date
    Dec 2000
    Location
    Karachi, Pakistan
    Posts
    913
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    qslack..


    i gave u thousands of seconds to reply.


    Regards,
    Omair Haroon
    36Host.com - $36/year web hosting [affiliates earn 30%]
    * Affordable Small Business Web Hosting since 2003! *
    "500mb space, 10gb bandwith, 50 pop/ftp accounts, php,
    mysql, pre-installed php scripts, 24/7 support & more...."



  9. #9
    Say WHA?! goober's Avatar
    Join Date
    Sep 2000
    Location
    United States
    Posts
    1,921
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    (NOTE: By the way, I'm assuming you're using Access. It can be modified for other DBs as well. Also, I'm sure you know most of the stuff i'm saying, but i'm explaining it all out in detail for other people who may not. Thanks for your patience. By the way, if you dont' have a login system I'll be writing a brief article on it sometime, and there's a huge thread on SPF that i did on it. Let me know for the link.)

    Okay, here's what you do:

    Firstly, You have a Table that looks something like this:

    ID: This field will be the field that ensures every comment is unique and can later be tracked, deleted, edited, etc. It is an autonumber field, and should incriment every time a comment is added automatically (make sure it is set for no duplicates). It's also the 'primary key'.
    ArticleID: Every comment should be associated with an article, and when you submit a comment for a certain article / page, it will stick the Article ID in here. Then, when you grab the DB records, you show all the comments that have that article ID. This is a number field.
    PosterName: The name of the poster. If you already have a user registration DB or a login system, we can use that, too. Just let me know and i'll pass on the workaround. Otherwise, this is simply a text field.
    PosterEMail: Should be self-explainitory. Entered by the user, unless you have a login system.
    Comment: The main text message. Should be a "memo" field to allow for the large size.
    CommentDate: The date that the comment was post. That part will be fairly easy.


    Now, onto the "theoretical part". I'm going to pseudo-code what you have to do right now (you know, without writing real code):

    You need a few pages. One, a page where users write comments. It directs to a page that actually does all the work, etc., and then the page that you already have for articles where the comments will be displayed.

    on your articles page, you'll have a link to the comments page that automatically has a querystring tacked onto the end of it with your article ID #.

    on the comment submission form, you need fields for the poster's name, e-mail address, and comment. This page passes the article ID # onto the next page.

    On the actual submission page, you connect to a database an insert all the information into the appropriate fields.

    On the articles page, you also run a SQL Query to see if there's any comments for a particular article. If the RS is empty, you print "no comments associated with this article". If that's not the case, you display the information in a neat, concise manner.

    Sound good? let me know what you think and we'll start on the code.

    And lastly, patience is a virtue.

    Hope this helps!! 'Till next time..
    Sean Killeen [LinkedIn] [Twitter] [Web]

    Warning: Reality.sys corrupted. Universe halted. Reboot? (Y/N)

  10. #10
    SitePoint Guru
    Join Date
    Dec 2000
    Location
    Karachi, Pakistan
    Posts
    913
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What else can I say except..


    THAT WAS A BRILLIANT IDEA!..



    Sound good? let me know what you think and we'll start on the code.
    What do you mean by that ? Are you gonna help me with the code ?



    Thanks
    36Host.com - $36/year web hosting [affiliates earn 30%]
    * Affordable Small Business Web Hosting since 2003! *
    "500mb space, 10gb bandwith, 50 pop/ftp accounts, php,
    mysql, pre-installed php scripts, 24/7 support & more...."



  11. #11
    ALT.NET - because we need it silver trophybronze trophy dhtmlgod's Avatar
    Join Date
    Jul 2001
    Location
    Scotland
    Posts
    4,836
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ive got a free download from my site that does exactly what ur looking for i think, if ur interested,pm me (im not posting my site again in the forum, last time i got yelled at )

  12. #12
    Say WHA?! goober's Avatar
    Join Date
    Sep 2000
    Location
    United States
    Posts
    1,921
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Omair, I'd help you with the code, yes, sure. lol. I was planning on it anyways.

    dhtmlgod, if you have a resource that could help, feel free to provide. I'll make sure you dont' get yelled at. It's used to help another member, not to simply promote your site.
    Sean Killeen [LinkedIn] [Twitter] [Web]

    Warning: Reality.sys corrupted. Universe halted. Reboot? (Y/N)

  13. #13
    SitePoint Guru
    Join Date
    Dec 2000
    Location
    Karachi, Pakistan
    Posts
    913
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well.. Goober.. from where should we began ?


    I need to launch the project by 1st of August..



    Regards,
    36Host.com - $36/year web hosting [affiliates earn 30%]
    * Affordable Small Business Web Hosting since 2003! *
    "500mb space, 10gb bandwith, 50 pop/ftp accounts, php,
    mysql, pre-installed php scripts, 24/7 support & more...."



  14. #14
    Say WHA?! goober's Avatar
    Join Date
    Sep 2000
    Location
    United States
    Posts
    1,921
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, start by making that databse in Access that I told you about in the previous thread.

    I'll post later with the beginnings of the code.
    Last edited by goober; Jul 28, 2001 at 07:49.
    Sean Killeen [LinkedIn] [Twitter] [Web]

    Warning: Reality.sys corrupted. Universe halted. Reboot? (Y/N)

  15. #15
    SitePoint Guru
    Join Date
    Dec 2000
    Location
    Karachi, Pakistan
    Posts
    913
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why not start it today only.. I need to publish the website by 1st.. So I guess we are left with only 26 hours or so.. and I have got a heck of work to be done...

    oh GOD!!!





    Regards,
    Disappointed Omair
    36Host.com - $36/year web hosting [affiliates earn 30%]
    * Affordable Small Business Web Hosting since 2003! *
    "500mb space, 10gb bandwith, 50 pop/ftp accounts, php,
    mysql, pre-installed php scripts, 24/7 support & more...."



  16. #16
    Say WHA?! goober's Avatar
    Join Date
    Sep 2000
    Location
    United States
    Posts
    1,921
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Tsk-tsk. Perhaps you'll think less about procrastinating from now on. Anyways, I do have things to do tonight, but i'll try to post when I get home.

    Anyone else, feel free to chime in in the meantime in accordance with my pseudo-code.
    Sean Killeen [LinkedIn] [Twitter] [Web]

    Warning: Reality.sys corrupted. Universe halted. Reboot? (Y/N)

  17. #17
    SitePoint Wizard big_al's Avatar
    Join Date
    May 2000
    Location
    Victoria, Australia
    Posts
    1,661
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    What goober has provided for you should be pretty easy to implement.

    Below is quick example of what the code should look like.

    USer Clicks on comments link and goes to the Comments page, in this example I'll call it comments.asp

    I'll have to make it pretty brief because I don't have too much time on my hands

    <%
    ArticleID = Request.QueryString("AID") ' Where AID is the part of the Query String that holds the article ID

    'Do all your conecting to the database here

    strSQL = "SELECT * FROM td_Comments WHERE ArticleID = "& ArticleID &""

    ' create recordsets

    If oRS = "" Then
    Response.write "No Comments"
    Else

    While not oRS.eof then
    Response.write "all the stuff you want to display here"
    oRS.MoveNext

    Wend
    oRS.Close
    Set oRS = Nothing ' etc etc
    End If

    You would also have a link somewhere for the person to add their own comment, you could pass that on to another page or just use Select Case, what ever you prefer to do. Let them fill out the form and then pass it on to a page that will insert the info in to your database. (I'm assuming that you know how to do this).

    Just remember to pass the Article ID accross the pages

    Hope this has helped a little.
    .NET Code Monkey

  18. #18
    SitePoint Guru
    Join Date
    Dec 2000
    Location
    Karachi, Pakistan
    Posts
    913
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks big_al ..

    let's see what goober have to say..


    Regards,
    Omair Haroon
    36Host.com - $36/year web hosting [affiliates earn 30%]
    * Affordable Small Business Web Hosting since 2003! *
    "500mb space, 10gb bandwith, 50 pop/ftp accounts, php,
    mysql, pre-installed php scripts, 24/7 support & more...."



  19. #19
    Say WHA?! goober's Avatar
    Join Date
    Sep 2000
    Location
    United States
    Posts
    1,921
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay, Omair, one quick question..

    Are you displaying all the user's comments on the same page as the article, or will they be on a separate page?

    This known, I can continue to code knowing that i won't have to backtrack and fix everything later.

    I'll try to get you hooked up by the end of today. I know that deadlines can be a *****.
    Sean Killeen [LinkedIn] [Twitter] [Web]

    Warning: Reality.sys corrupted. Universe halted. Reboot? (Y/N)

  20. #20
    SitePoint Guru
    Join Date
    Dec 2000
    Location
    Karachi, Pakistan
    Posts
    913
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hmm.. Goober.. The deadline have been extended..

    Sorry for the late reply but I was dead busy with the project..

    Twice I was not able to lunch properly..

    But I am getting moneyy... and a big one..


    I would be showing the comments on a page which would be linked on the article page..


    Anymore questions..
    I have now eight more days to go and a hell lot of work to do..


    Regards,
    Omair Haroon
    36Host.com - $36/year web hosting [affiliates earn 30%]
    * Affordable Small Business Web Hosting since 2003! *
    "500mb space, 10gb bandwith, 50 pop/ftp accounts, php,
    mysql, pre-installed php scripts, 24/7 support & more...."



  21. #21
    Say WHA?! goober's Avatar
    Join Date
    Sep 2000
    Location
    United States
    Posts
    1,921
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Omair,

    that should be sufficient for me to start.

    In this project, by the way, I'm going to assume that it's an Access 2000 DB that you're using, because that's where my coding is the most error-free.

    Have you created the DB? I'd like to have a working copy to test with, i mean, if you could put it up on the internet, I could give you the code, and then you could let me view the page for errors, etc.
    Sean Killeen [LinkedIn] [Twitter] [Web]

    Warning: Reality.sys corrupted. Universe halted. Reboot? (Y/N)

  22. #22
    SitePoint Guru
    Join Date
    Dec 2000
    Location
    Karachi, Pakistan
    Posts
    913
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I could not get what do you mean ??
    36Host.com - $36/year web hosting [affiliates earn 30%]
    * Affordable Small Business Web Hosting since 2003! *
    "500mb space, 10gb bandwith, 50 pop/ftp accounts, php,
    mysql, pre-installed php scripts, 24/7 support & more...."



  23. #23
    Say WHA?! goober's Avatar
    Join Date
    Sep 2000
    Location
    United States
    Posts
    1,921
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Open Access, and create the database with all those fields that i showed you in an earlier post. That way, when i outline the code, you put it in an ASP page, and put it on the internet, and that way when i go to the page by typing in the URL i can see if there's any errors.

    Understand a little better now?
    Sean Killeen [LinkedIn] [Twitter] [Web]

    Warning: Reality.sys corrupted. Universe halted. Reboot? (Y/N)

  24. #24
    SitePoint Guru
    Join Date
    Dec 2000
    Location
    Karachi, Pakistan
    Posts
    913
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yup
    36Host.com - $36/year web hosting [affiliates earn 30%]
    * Affordable Small Business Web Hosting since 2003! *
    "500mb space, 10gb bandwith, 50 pop/ftp accounts, php,
    mysql, pre-installed php scripts, 24/7 support & more...."




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
  •