[geeklog-users] Review Block

Vincent Furia vmf at abtech.org
Thu Feb 20 09:39:40 EST 2003


This is pretty easy to implement by creating a 'review' topic.  Once you
have a review topic, create a php_block that selects the X most recent
stories in the 'review' topic and displays them.  Your php_block function
would look something like this:

function phpblock_recentreviews() {
    global $_TABLES;

    $num_rev = 10; //number of recent reviews to display

    $sql = "SELECT sid,title FROM " . $_TABLES['stories'] . " WHERE "
         . "tid = '<review_topic_id>' " 
         . "ORDER BY date DESC LIMIT $num_rev";

    $results = $do_query($sql);
    $numrows = DB_numrows($resutls);
   
    $retval .= "Recent Reviews<BR><UL>
    for ($i=0; $i<$numrows; $i++) {
       $A = DB_fetchArray($result);
       $retval .= "<LI>" . $A['title'] . "</LI>";
    }
    $retval .= "</UL>";
    return $retval;
}

You'll probably want to improve the above code alot (like by adding
security to the SQL statement and making better output), but it should
give you then general idea.  I'm sure someone already has a block like
this out there...

Good Luck,
Vinny

On Wed, 19 Feb 2003, Yury German wrote:

> Does anyone know if there is a block or a hack that will allow an article
> to be posted as a review.
> 
> Once the article is marked as a review it will still appear on the list
> but will also appear in a block as rescent reviews.
> 
> Something similar to book reviews available at www.slashdot.org
> 
> Thanks!
> 
> 
> _______________________________________________
> geeklog-users mailing list
> geeklog-users at lists.geeklog.net
> http://lists.geeklog.net/listinfo/geeklog-users
> 
> 




More information about the geeklog-users mailing list