Fork me on GitHub

PHP Code : New in 3days... Please..  Bottom

  • Hi.. Need some help from PHP/PN expert..

    Just want to made block that listing new stories.. AND with notice that it`s new in 3 days by image new_3.gif.. (Block Type = PHP Script)

    Thank for Chestnutfor help me with this script.. but still have problem to show notice that the story was new in 3 days.. ( $newimage ??? )

    Please.. please.. really need this..

    Code

    $cat = 2;
    $limit = 5;

    list($dbconn) = pnDBGetConn();
    $pntable = pnDBGetTables();
    $query = "SELECT pn_sid, pn_title, pn_hometext, pn_informant, pn_time FROM $pntable[stories]
    WHERE  pn_catid='"
    .pnVarPrepForStore($cat)."'
    ORDER BY pn_time DESC LIMIT "
    .pnVarPrepForStore($limit);
         
    $result = $dbconn->Execute($query);
      while(list($sid, $headlinetitle, $story, $info, $stime) = $result->fields)
    {
      $result->MoveNext();
         
    if (date("Y-m-d H:i:s", $stime) >= date("Y-m-d H:i:s", strtotime("-3 DAY"))) {
    $newimage = "images/global/new3.gif";
    } else {
    $newimage = "images/global/dot.gif";
    }
         
        $content .= "<br><img src=\"".$newimage."\"> ";
           
            $content .= "<a href=\"modules.php?op=modload&name=News&file=article&sid=".pnVarPrepForDisplay($sid)."\">";
            $content .= "<b>".pnVarPrepForDisplay($headlinetitle)."</b></a>";
             
    if(strlen($story) > 110)
    {$story = substr($story,0,110);
    $story .= "...";}    
           
        $content .= "<br>$story";
    }
    printf($content);

This list is based on users active over the last 60 minutes.