function GetArticlesList($params=null) { global $par, $varsline; $list = Array(); $sql="SELECT * FROM $par->news2table WHERE `hide`=0"; if(isset($params['orderby'])) $sql.=" ORDER BY ".$params['orderby']; if(isset($params['start']) && isset($params['itemsinpage'])) $sql.=" LIMIT ".$params['start']." , ".$params['itemsinpage']; $res = mysql_query($sql); while( $line = mysql_fetch_array($res,MYSQL_ASSOC) ) { $list[] = GetArticlesItem($line['id'],$line); } return $list; }
<? if ($act=='articles' && $id!=0) { $_logic['content']=Array(); $_logic['content'] = GetArticlesItem($id); $_logic['content']['allnewsurl'] = GetSeoUrl('articles',0); } if ($act=='articles' && $id==0) { $_logic['content']=Array(); $sql = "SELECT * FROM $par->topmenutable WHERE `url`='/articles'"; $res = mysql_query($sql); if($line = mysql_fetch_array($res,MYSQL_ASSOC)) { $line = LangProcess($line); $_logic['content']['title'] = $line['title']; $_logic['content']['text'] = $line['text']; } $newsinpage = 5; $_logic['content']['items'] = GetArticlesList( Array('orderby'=>'prior DESC', 'start'=>$start, 'itemsinpage'=>$newsinpage) ); $sql2 = "SELECT COUNT(id) AS ccc FROM $par->news2table WHERE `hide`=0"; $linkstr = GetSeoUrl('articles',0); $_logic['content']['pagerarr']=GetPager($sql2,$linkstr,$newsinpage); } ?>