fetchByIndex(0), 255); $nw_id = clean($pathVars->fetchByIndex(1), 7); if ($cat_name) { $cat_id = array_search($cat_name, $cat_urls); $title = $cat_names[$cat_id].' Articles'; } else { $title = 'Article Categories'; } /* echo '
';
print_r($cats);
echo '
'; echo $cat_name; */ //echo '
cat_id:'.$cat_id.'
'; function show_article($nw_id, $fieldlist, $cat_id, $db_conn) { $sql= 'SELECT '.$fieldlist.', UNIX_TIMESTAMP(nw_date) AS nw_date FROM nw_news WHERE nw_id="'.$nw_id.'" and cat_id="'.$cat_id.'"'; if (!($result = @ mysql_query($sql, $db_conn))) {showerror(); } if (mysql_num_rows($result) != 1) { //header('Location: '.PUBL_DOMAIN.'/notfound.php'); //exit; } echo '
'; $row = @ mysql_fetch_array($result, MYSQL_ASSOC); //print_r($row); if ($row['nw_img_filename']) { $img = ''; } if (!$row['nw_title']) { $row['nw_title'] = $row['nw_head']; } echo '

'.nl2br($row['nw_title']).'

'; if ($row['nw_author']) { echo '

by '.nl2br($row['nw_author']).'

'; } if ($row['nw_img_filename'] && $row['nw_img_pos']<3) { echo '
'.$img.'
'; } echo '
'.$row['nw_text'].'
'; if ($row['nw_img_filename'] && $row['nw_img_pos'] == 3) { echo '
'.$img.'
'; } echo '
This article was posted on '.date('j F \'y', $row['nw_date']).'
'; echo '
 
'; if (!$row['nw_archive']) { echo '

« list of articles

'; } else { echo '

« archive

'; } echo '
'; } function show_articles($cat_id, $cat_urls, $fieldlist, $db_conn) { echo '
'; $sql= 'SELECT '.$fieldlist.', UNIX_TIMESTAMP(nw_date) AS nw_date FROM nw_news WHERE nw_archive='.($archive?1:0).' AND cat_id="'.$cat_id.'" ORDER BY nw_archive, nw_order'; if (!($result = mysql_query ($sql, $db_conn))) {showerror();} // *********************************************************************************** $pagnum = &new nw_pagnum( array( 'numtoshow' => 12, 'str_results_prefix' => 'Article', 'sql' => $sql, 'db_conn' => $db_conn, 'p' => $p ) ); $p_data = $pagnum->getlinks(); echo '
' .$p_data['results'].'
'; echo $p_data['full']; if ($p_data['total_results']) { while ($row = @ mysql_fetch_array($pagnum->get_result(), MYSQL_ASSOC)) { //if (!$row['nw_archive']) { echo '
'; echo '

'.$row['nw_head'].'

'; if ($row['nw_author']) { echo '

by '.nl2br($row['nw_author']).'

'; } echo $row['nw_brief']; //echo '
more...
'; //echo '
'.date('j F \'y', $row['nw_date']).'
'; //Tuesday, September 5th, 2006 //echo '
'; echo '
'; if ($row['nw_text']) { echo '
'.date('j F \'y', $row['nw_date']).'
'; echo '...more'; } else { echo '
 
'; } echo '
'; echo '
'; } echo $p_data['lite']; } echo ''; } function show_catlist($cat_names, $cat_urls, $db_conn) { echo ''; } $fieldlist = implode(', ', array_merge($news_fields, $img_fields)); $tmpl1arr['css'][] = 'news'; tmpl1($title, $tmpl1arr); tmpl2($title); //echo '
Articles'; //echo ' |  Archive
'; if ($nw_id) { show_article($nw_id, $fieldlist, $cat_id, $db_conn); } else if ($cat_id) { show_articles($cat_id, $cat_urls, $fieldlist, $db_conn); } else { show_catlist($cat_names, $cat_urls, $db_conn); } tmpl3(); ?>