0){ $ex_filename = explode("/",$filename); if($ex_filename[0]=="clothes"){ // now need to check for page1,page2 etc before moving on // as we need to trap somebody hacking in if(count($ex_filename) <4){ if(count($ex_filename) == 2){ $page_no = 1; } else{ $page_no = $ex_filename[2]; } } else{ // redirect error page does not exist } //print($current_page); $test="product_listing"; } else{ $test=="product"; $sql_product = mysql_query("SELECT * FROM products WHERE unique_url='$filename'",$link); if($sql_product){ if(mysql_num_rows($sql_product)==1){ $test="product"; $product = mysql_fetch_array($sql_product); } else{ // product does not exist, redirect to an error page } } else{ // product does not exist, redirect to an error page } } } else{ } } if($test=="product"){ // display = 1 needs adding to sql list // in this case $cat_id = $product['my_category']; $category = mysql_query("SELECT * FROM category WHERE cat_id='$cat_id'",$link); $cat = mysql_fetch_array($category); $linkshare_id = $product['linkshare_id']; $sql_m = mysql_query("SELECT * FROM merchants WHERE linkshare_id='$linkshare_id'",$link); $merchant = mysql_fetch_array($sql_m); if(trim($product['brand']) == "" or $product['brand'] == null){ // then use merchant name $image_title = $product['short_product_desc']." by ".$merchant['names']; $breadcrumbs = "Home > Womens Fashion > ".ucfirst($product['product_name']); //$breadcrumbs = "Home > ".$merchant['names']." > ".$product['product_name']; } else{ $image_title = $product['short_product_desc']." from ".$product['brand']; $breadcrumbs = "Home > Womens Fashion > ".ucfirst($product['product_name']); //$breadcrumbs = "Home > ".$merchant['names']." > ".$product['product_name']; } // set metatags adjust later depending on page type $mtitle = $product['mtitle']; $mdesc = $product['mdesc']; $mkeywords = $product['mkeywords']; } elseif($test=="product_listing"){ $no_products = 30; $max_page = 6; //$pages = "test"; $category = mysql_query("SELECT * FROM category WHERE unique_url='$ex_filename[1]'",$link); $cat = mysql_fetch_array($category); $cat1 = $cat['cat_id']; // find total number of products available $sql_tn = mysql_query("SELECT * FROM products WHERE my_category='$cat1' and display='1'", $link); if($sql_tn){ $all_products = mysql_num_rows($sql_tn); // calculate pages to display if($page_no==1){ $start_no =0; if($all_products<$no_products-1){ $end_no=$all_products; } else{ $end_no = $no_products; } } else{ $start_no =($no_products*($page_no-1)); $end_no = $no_products; if($all_products<$end_no){ $end_no = $all_products-$start_no; } } $sql_product = mysql_query("SELECT * FROM products WHERE my_category='$cat1' and display='1' ORDER BY date_created DESC LIMIT $start_no,$end_no",$link); $num_of_pages =ceil($all_products/$no_products); if($num_of_pages>1){ $pages = "
"; } } $breadcrumbs = "Home > Clothes > ".$cat['description']; // needs work } elseif($filename=="index"){ $test = "front"; } ?> <?php print($mtitle); ?> '); print(''); $url_c = "http://iheartthehighstreet.co.uk/".$product['unique_url']."/"; print(''); $url_i = "http://wadmin.iheartthehighstreet.co.uk/".$product['image_name']; print(''); print(''); } ?>