Sorry, this page is only available in one language

GetNewsHeads

Suggested dropletname: GetNewsHeads

Published by: KonTrax

Just a simple droplet that generates linked headlines from a newsgroup.

if ( !isset($max) ){    $max = 10;    }
if ( !isset($start_date) ){    $start_date= "-10 day";    }
if ( !isset($stop_date) ){    $stop_date= "now";    }
if ( !isset($order) ){    $order= "DESC";    }
global $database, $wb;
$mod_query = $database->query("SELECT title, link, published_when FROM ".TABLE_PREFIX.
"mod_news_posts WHERE active='1' AND group_id = ".$group.
" AND published_when>=".strtotime($start_date).
" AND published_when<=".strtotime($stop_date).
" ORDER BY post_id ".$order." LIMIT ".$max);
$mod_list = " ";
while ( $row =& $mod_query->fetchRow()){
 $mod_list .= '<a href="'.WB_URL.PAGES_DIRECTORY.$row['link'].PAGE_EXTENSION.'">'.$row['title'].'</a><br>';
}
return $mod_list;

Example:

[[GetNewsHeads?group=2&max=2&start_date=-3 day&stop_date=now&order=ASC]]

Explanation of the parameters:

max : max newspost headlines to collect  *  optional ("10" by default)

start_date : earlyest newspost headlines to collect  *  optional ("-10 day" by default)

stop_date : latest newspost headlines to collect  *  optional ("now" by default)

order : Newest or Oldest posts first  *  optional ("ASC" or "DESC", "DESC" by default)

Date examples:
now
- / +1 day
- / +1 week
- / +1 month
- / +1 year
- / +1 year 1 month 1 week 1 day
10 September 2000
next Thursday
last Monday



« Previous droplet | Overview | Next droplet »