dbQuery($sql); $holders["CATEGORIES"]=''; while ($row=$db->fetch_array("both")) { $temp["CAT_URL"]=$document_root.$category_folder.NameEncode($row['name']).$config['trailing_url']; $temp["CAT_NAME"]=$row['name']; $temp["CAT_SHORTNAME"]=$row['shortname']; $temp["CAT_NUM"]=countChildren($row['id'],true); $temp["CAT_TITLE_TEXT"]=$row['title_text']; $temp["CAT_HEADER_TEXT"]=$row['header_text']; $temp["CAT_FIELD1"]=$row['field1']; $temp["CAT_FIELD2"]=$row['field2']; $temp["CAT_FIELD3"]=$row['field3']; $temp["CAT_SECTION"]=$row['section']; $holders["CATEGORIES"].=$tpl->parse_template('featured_categoryitem',$temp); } unset($temp); //Filter $db->dbQuery("SELECT * FROM link_types ORDER BY pos DESC, name"); $holders["FILTER"]=''; $temp1=array(); $temp1["ITEMS"]=''; $temp1["ALL"]=''; while ($row=$db->fetch_array('both')) { $temp["TYPE_ID"]=$row['id']; $temp["TYPE_NAME"]=$row['name']; $temp["TYPE_DESCR"]=$row['descr']; $temp["TYPE_DISPLAY"]=$row['display']; $temp["TYPE_POSITION"]=$row['pos']; if ($_COOKIE['type']==$row['id']) $temp1["ITEMS"].=$tpl->parse_template('filter_item_active',$temp); else $temp1["ITEMS"].=$tpl->parse_template('filter_item_passive',$temp); } if ($_COOKIE['type']=='' || $_COOKIE['type']=='NONE') $temp1['ALL']=$tpl->get_template('filter_all_active'); else $temp1['ALL']=$tpl->get_template('filter_all_passive'); $holders["FILTER"]=$tpl->parse_template('filter',$temp1); unset($temp);unset($temp1); //Friends $holders["FRIENDS"]=''; $db->dbQuery("SELECT name,url,descr,pos FROM friends ORDER BY pos DESC, name"); while ($row=$db->fetch_array('both')) { $temp["FRIEND_URL"]=$row['url']; $temp["FRIEND_NAME"]=$row['name']; $temp["FRIEND_DESCR"]=$row['descr']; $holders["FRIENDS"].=$tpl->parse_template('featured_frienditem',$temp); } unset($temp); //News $db->dbQuery("SELECT id,ndate,descr,content FROM news ORDER BY ndate DESC"); $holders["NEWS"]=''; while ($row=$db->fetch_array("both")) { $temp["NEWS_DATE"]=parse_date($row['ndate']); $temp["NEWS_DESCR"]=$row['descr']; $temp["NEWS_CONTENT"]=$row['content']; $holders["NEWS"].=$tpl->parse_template('featured_newsitem',$temp); } unset($temp); $sql="SELECT i.id, i.name, i.descr, i.keywords, i.url, i.ndate, c.shortname AS niche, c.name AS category, i.featured, i.weight, i.voted_rating, i.voted_num, i.pos, s.name AS section, l.name AS l_name, l.descr AS l_descr, l.display AS l_display, l.pos AS l_pos FROM items i LEFT OUTER JOIN categories c ON i.ref_id_categories=c.id LEFT OUTER JOIN sections s ON c.ref_id_sections=s.id LEFT OUTER JOIN link_types l ON i.ref_id_link_types=l.id WHERE i.featured=1 $add_where ".GetOrder('link','featured'); //Pager PagerPrepare($sql,$config['featured_ipp']); $color1=$config["row_item_color"]; $color2=$config["row_item_color_intermediary"]; $flag=false; $holders["ITEMS"]=""; $db->dbQuery($sql.$PAGER['limit']); //Items while ($row=$db->fetch_array("both")) { $flag=!$flag; $temp["ITEM_BG"]=($flag)?$color1:$color2; $temp["ITEM_ID"]=$row["id"]; $temp["ITEM_NAME"]=$row["name"]; $temp["ITEM_DESCR"]=$row["descr"]; $temp["ITEM_URL"]=$row["url"]; $temp["ITEM_DATE"]=parse_date($row["ndate"]); $temp["ITEM_SPARE"]=$row["keywords"]; $temp["ITEM_TYPE_NAME"]=$row['l_name']; $temp["ITEM_TYPE_DESCR"]=$row['l_descr']; $temp["ITEM_TYPE_DISPLAY"]=$row['l_display']; $temp["ITEM_TYPE"]=$row['l_display']; $temp["ITEM_TYPE_POS"]=$row['l_pos']; $temp["ITEM_NICHE"]=$row["niche"]; $temp["ITEM_SECTION"]=$row["section"]; $temp["ITEM_CAT_URL"]=$document_root.$category_folder.NameEncode($row['category']).$config['trailing_url']; ereg('([0-9]{4})-([0-9]{2})-([0-9]{2})',$row['ndate'],$regs); $time=mktime(1,0,0,$regs[2],$regs[3],$regs[1]); $temp["ITEM_NEW"]=(time()<=round($time+(int)$config['new_before_days']*60*60*24,0))?$tpl->get_template('featured_item_new'):""; //Weight $weight1=""; for ($i=1;$i<=$row["weight"];$i++) $weight1.=$tpl->get_template("featured_item_weight_star"); $temp1["WEIGHT_NUM"]=$row["weight"]; $temp1["WEIGHT_STARS"]=$weight1; $temp["ITEM_WEIGHT"]=$tpl->parse_template("featured_item_weight",$temp1); unset($temp1); //Rating $weight1=""; for ($i=1;$i<=round((float)$row["voted_rating"],0);$i++) $weight1.=$tpl->get_template("featured_item_rating_star"); $temp1["RATING_NUM"]=round((float)$row["voted_rating"],0); $temp1["RATING_STARS"]=$weight1; $temp["ITEM_RATING"]=$tpl->parse_template("featured_item_rating",$temp1); $temp["ITEM_VOTEDNUM"]=(int)$row['voted_num']; unset($temp1); $holders["ITEMS"].=$tpl->parse_template("featured_item",$temp); } unset($temp); //Pager $holders["PAGER_PAGE"]=$PAGER['page']; $holders["PAGER_PAGES"]=$PAGER['pages']; $holders["PAGER"]=PagerPrint(); unset($temp1); if ($PAGER['num']<=0) $holders["ITEMS"]=$tpl->get_template('featured_noitems'); //Stats $holders["STATS_FIRST"]=$PAGER['first']; $holders["STATS_LAST"]=$PAGER['last']; $holders["STATS_RECORDS"]=$PAGER['num']; $db->dbQuery("SELECT count(ref_id_categories) AS cnt FROM cat_relations"); $row=$db->fetch_array('both'); $holders["STATS_TOTAL"]=$row['cnt']; echo $tpl->parse_template("featured",$holders); $db->cleanUp(); ?>