Review Script with users picture

Discussion in 'PHP' started by darksen, Apr 29, 2007.

  1. #1
    Hi,

    Can someone point me where to find a review script with users picture beside their name once they enter a comment.

    I've already search hotscripts and other script directory but no luck. All I see is a typical review script where user can post comment(without their own picture(avatar). I've check hot or not also but again the rater doesnt have a photo beside his/her name.


    i'm creating one actually but it will take awhile since i'm not good at PHP programming.

    thanks
     
    darksen, Apr 29, 2007 IP
  2. firmaterra

    firmaterra Peon

    Messages:
    756
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Hmm, dunno where you'd pick one up. Its generally integrated into the comment scripts that are floating around. This may speed things up a bit for you though.

    After the user has uploaded a file and you've processed it, checked it, and stored it you can pull it up along with the comments. For this you need an sql table that will store the comment ID, User ID, Reference ID (eg the video your commenting on etc) and profile_picture (set to yes or no depending on whether the user has uploaded a profile picture).

    Alternatively you could enter whether the user has a profile picture in the users main table.

    Presuming we're going the first way:
    //get comments from comments table where the item number =5
    $sql="select * from comments where item_number='5'";
    //connect to DB and execute sql query. Put in your connection details here.
    $rs=$conn->execute($sql);
    //get the comments:
    $comments=$rs->getarray();

    I use SMarty, so I'll assign the comments to the template engine:
    STemplate::assign('comments', $comments);

    In your template file you now want to loop throught the above array. This array holds the comment, the user and the profile picture details (yes or no).
    So:

    {section name=i loop=$comments}
    <tr>
    <td>
    //if the profile picture field is 'yes' user has a profile picture:
    {if $comments.profile_picture eq "yes"}
    <img scr="path to profile picture">
    {else}
    //user has no profile picture...use the default!
    <im src="path to default picture">
    {/if}
    </td>
    <td>{$comments.comment}</td>
    <td>{$comments.date}</td>
    etc....

    Hope this is of some help to you.
     
    firmaterra, Apr 30, 2007 IP