News

number_links = 5; $test->sql = "SELECT * FROM news_items WHERE 'pdate' >= '$current_time' ORDER BY date DESC, timestamp DESC"; // the (basic) sql statement (use the SQL whatever you like) $result = $test->get_page_result(); // result set $num_rows = $test->get_page_num_rows(); // number of records in result set for ($i = 0; $i < $num_rows; $i++) { $key = mysql_result($result, $i, "key"); $dtimestamp = mysql_result($result, $i, "date"); $dday = date('j',$dtimestamp); $dmonth = date('M',$dtimestamp); $dyear = date('Y',$dtimestamp); $ptimestamp = mysql_result($result, $i, "pdate"); $pday = date('j',$ptimestamp); $pmonth = date('M',$ptimestamp); $pyear = date('Y',$ptimestamp); $timestamp = mysql_result($result, $i, "timestamp"); $title = mysql_result($result, $i, "title"); $news = mysql_result($result, $i, "description"); $image = mysql_result($result, $i, "file"); $len = 0; $pos = 0; $order = array("\r\n", "\n", "\r"); $news = str_replace($order,'
',$news); // // preg_match('/()([^`]*?)(<\/a>)/',$news,$match); // search for link // if ($match) { // there is a link // $news = str_replace($match[1],'',$news); // $news = str_replace('','',$news); // } $news = strip_tags ($news,'
'); $news = str_replace("
",' ',$news); $pos = strpos($news,'
'); if ($pos > 0) { $news = substr($news,0,$pos); } $news = substr($news,0,250+$len); // where to cut the text off for main page $space = strrpos($news,' '); $news = substr($news,0,$space); // go to the last space of text, don't show part of a word $test->forw = "►"; $test->back = "◄"; $nav_links = $test->navigation(" ", "currentStyle", false, false, false, true); // the navigation links (define a CSS class selector for the current link) ?>
... more.