0) { $cat = $mysql->q("SELECT * FROM cats WHERE id='".$_GET["cid"]."'"); $quotes = $mysql->fetch("SELECT * FROM quotes WHERE cat1='".$_GET["cid"]."' OR cat2='".$_GET["cid"]."' OR cat3='".$_GET["cid"]."' OR cat4='".$_GET["cid"]."' OR cat5='".$_GET["cid"]."' ORDER BY quote ASC LIMIT ".(($page -1 ) * $pagesize).", ". $pagesize); $total = mysql_num_rows($mysql->q("SELECT * FROM quotes WHERE cat1='".$_GET["cid"]."' OR cat2='".$_GET["cid"]."' OR cat3='".$_GET["cid"]."' OR cat4='".$_GET["cid"]."' OR cat5='".$_GET["cid"]."'", true)); $params["cat_name"] = $cat["name"]; $id = intval($_GET["cid"]); $sql = "SELECT * FROM cats_stat WHERE cat_id = '$id'"; $stat = $mysql->q($sql); if (is_array($stat)){ $sql = "UPDATE cats_stat SET count=count+1 WHERE cat_id = '$id'"; } else { $sql = "INSERT INTO cats_stat (cat_id, count) VALUES ('$id', 1)"; } $mysql->execute($sql); $sql = "SELECT id_dest, name FROM cats_connect, cats WHERE cats.id=cats_connect.id_dest AND id_src = ".intval($_GET["cid"]); $result = $mysql->fetch($sql); if (count($result)){ foreach($result as $res){ $similar_cats .= "".$res['name'].""; } $params['connection'] = '
Andre aktuelle kategorier:
'.$similar_cats.'
'; } $params['total'] = $total; $b = 1; foreach ($quotes as $key=>$quote) { $author = $mysql->q("SELECT * FROM authors WHERE id='".$quote["authorid"]."'"); if ($author["lastname"] == 'Ordtak') { $param["script"] = 'ordtak.php'; } else { $param["script"] = 'forfatter.php'; } $param["quote"] = $quote["quote"]; $param["fn"] = urlencode($author["firstname"]); $param["ln"] = urlencode($author["lastname"]); $param["firstname"] = ucfirst(strtolower($author["firstname"])); $param["lastname"] = ucfirst(strtolower($author["lastname"])); $param['banner'] = null; // first google ads banner if($b == FIRST_BANNER_AFTER){ $code = $mysql->getval('banners', 'code', "name LIKE '%".FIRST_BANNER_NAME."%'"); $param['banner'] = $code; } // put google ads banner after 10 quotes if(count($quotes)!= 10 && $b == 10){ $code = $mysql->getval('banners', 'code', "random = '1' order by rand() limit 1"); $param['banner'] = $code; } if((count($quotes)<=$SECOND_BANNER_AFTER && $b == count($quotes)) || $b == $SECOND_BANNER_AFTER){ $SECOND_BANNER_AFTER += 10; $code = $mysql->getval('banners', 'code', "random = '1' order by rand() limit 1"); $param['banner'] = $code; } // put the google ads banner at the bottom af page if there is not enough quotes if(count($quotes) == $b && count($quotes) < FIRST_BANNER_AFTER && $b != 10){ $code = $mysql->getval('banners', 'code', "name LIKE '%".FIRST_BANNER_NAME."%'"); $param['banner'] = $code; } $b++; $template->assign_block_vars("ordtak", $param); } } else { $letter = 'A'; if (!empty($_GET['letter'])){ $letter = substr(htmlspecialchars(addslashes($_GET['letter'])), 0, 1); } $sql = "SELECT * FROM cats WHERE name LIKE '$letter%' ORDER BY name ASC"; $categories = $mysql->fetch($sql); foreach ($categories as $category){ $template->assign_block_vars("list", $category); } } ob_start(); $paging = new paging($page, $total, $pagesize); $paging->setTitle(""); $paging->setNPlinks(false); $paging->setFormat("?page=%d&cid=".$_GET["cid"]); print $paging->getHTML(); $params["paging"] = ob_get_contents(); ob_end_clean(); //seo stuff, very basic $params['header'] = preg_replace("/\([^<]*)\<\/title\>/", "Kjente sitater og ordtak som inneholder temaet ".$params["cat_name"]."", $params['header']); $params['header'] = preg_replace("/\/", "", $params['header']); $params['header'] = preg_replace("/\/", "", $params['header']); $template->assign_vars($params); $template->pparse("emne"); ?>