query($csql); $CRS = $db->fetch_array($CRSQ); if ($CRS==0) { $csql = "SELECT * FROM `categories` WHERE `id` = 3 LIMIT 1"; $CRSQ = $db->query($csql); $CRS = $db->fetch_array($CRSQ); } $top_cat_id = $CRS[id]; if ($CRS[cat_color]!="0") { $top_cat_id = $CRS[id]; $_SESSION[thiscol]=$CRS[cat_color]; } $views_sql = "UPDATE `categories` SET `cat_views` = `cat_views` + 1 WHERE `id` = '$CRS[id]'"; $thiscatparent = $CRS[cat_parent_id]; $thiscatid = $CRS[id]; $thiscat = $CRS[cat_shortcut]; $thiscattitle = $CRS[cat_name]; $title_links = "/ ".strtoupper($thiscattitle).""; $meta_title = $thiscattitle." videos from the "; $loop_sql = "SELECT * FROM `videos` WHERE `active` = '1' AND (`video_cat_id` = ".$thiscatid." OR `video_cat_id2` = ".$thiscatid." OR `video_cat_id3` = ".$thiscatid.")"; $x=0; while ($CRS[cat_parent_id]>0 && $x<5) { $csql = "SELECT * FROM `categories` WHERE `id` = $thiscatparent LIMIT 1"; $CRSQ = $db->query($csql); $CRS = $db->fetch_array($CRSQ); $views_sql.= " OR `id` = '$CRS[id]'"; $thiscatparent = $CRS[cat_parent_id]; $title_links = "/ ".strtoupper($CRS[cat_name])." ".$title_links; $meta_title = $meta_title.$CRS[cat_name]." / "; if ($CRS[cat_color]!="0") { $top_cat_id = $CRS[id]; $_SESSION[thiscol]=$CRS[cat_color]; } $x++; } // UPDATE VIEWS $db->query($views_sql); $meta_title.=$thiscattitle." category"; include('includes/header.php'); ?>

VIDEOS IN THE '' CATEGORY:

query($count_sql); $CRS = $db->fetch_array($CRSQ); $total_records = $CRS[num_records]; // we get the current page from $_GET if (isset($_GET['pg'])){ $page = (int) $_GET['pg']; } $pglink=$_SESSION[baseurl]."/".$thiscat."/page"; // create the pagination class $pagination = new Pagination(); $pagination->setLink($pglink."%s"); $pagination->setPage($page); $pagination->setSize($size); $pagination->setTotalRecords($total_records); $csql = $loop_sql." ORDER BY `video_added` DESC ". $pagination->getLimitSql(); $CRSQ = $db->query($csql); $CRS = $db->fetch_array($CRSQ); $x=1; while ($CRS!=0) { $lsql = "SELECT `cat_shortcut` FROM `categories` WHERE `id` = $CRS[video_cat_id]"; $LRSQ = $db->query($lsql); $LRS = $db->fetch_array($LRSQ); ?> <? echo $CRS[video_title]; ?>
fetch_array($CRSQ); } ?>
create_links(); echo $navigation; // will draw our page navigation ?>
query($csql); $CRS = $db->fetch_array($CRSQ); if ($CRS==0) { ?>
MORE VIDEOS FROM THE CATEGORY: