Complete Pagination
Hi, i'm working on a pagination gallery...
But i have one problem, i can't seperate the images :S Can someone help me? <?php if($page == "all"){ $page_number = 1; // how many records per page $size = 8; // we get the current page from $_GET if (isset($_GET['page'])){ $page_number = (int) $_GET['page']; } /**************************************************/ $result_images=mysql_query("SELECT * FROM album_lang WHERE lang='".$current_lang."'"); $row_images=mysql_fetch_assoc($result_images); $result_content=mysql_query("SELECT * FROM album_images_lang WHERE lang='".$current_lang."' AND visivel=1 "); $total_records = mysql_num_rows($result_content); $result_imagens=mysql_query("SELECT * FROM album_images WHERE id='".$total_records['id_image']."' AND visivel=1"); $total_imagens=mysql_fetch_assoc($result_imagens); /**************************************************/ // create the pagination class $pagination = new Pagination(); $pagination->setLink($current_lang."/gallery/all?page=%s"); $pagination->setPage($page_number); $pagination->setSize($size); $pagination->setTotalRecords($total_records); /**************************************************/ $result_content=mysql_query("SELECT * FROM album_lang WHERE titulo='' AND lang='$current_lang' AND visivel=1 " . $pagination->getLimitSql()); /**************************************************/ $navigation = $pagination->create_links(); }else{ /**************************************************/ if(isset($clean_url[3]) && $clean_url != ""){ $product = $clean_url[3]; $result_content=mysql_query("SELECT * FROM album_lang WHERE titulo='".$clean_url[2]."' AND lang='$current_lang' AND visivel=1"); }else{ /**************************************************/ $page_number = 1; // how many records per page $size = 8; // we get the current page from $_GET if (isset($_GET['page'])){ $page_number = (int) $_GET['page']; } /**************************************************/ $result_content=mysql_query("SELECT * FROM album_images WHERE visivel=1"); $total_records = mysql_num_rows($result_content); /**************************************************/ // create the pagination class $pagination = new Pagination(); $pagination->setLink($current_lang."/gallery/all?page=%s"); $pagination->setPage($page_number); $pagination->setSize($size); $pagination->setTotalRecords($total_records); /**************************************************/ $result_content=mysql_query("SELECT * FROM album WHERE id='".$tax_id."' AND lang='$current_lang' AND visivel=1 " . $pagination->getLimitSql()); /**************************************************/ $navigation = $pagination->create_links(); } } $num_rows_content = mysql_num_rows($result_content); $conta_rows_content = 1; $content = ""; if($num_rows_content > 0 || $page == "all"){ echo '<div class="content" id="page"> <div class="container"> <div class="interior_page" style="border-bottom:0px;">'; if($page == "all"){ $pageTitle="GALERIA"; }else{ if(isset($clean_url[3]) && $clean_url != ""){ $pageTitle = $row_content->titulo; }else{ $result_tax_titulo = mysql_query("SELECT * FROM `album_images` WHERE visivel=1 LIMIT 0,1"); $row_tax_titulo = mysql_fetch_object($result_tax_titulo); $row_titulo=mysql_fetch_assoc($result_tax_titulo); $pageTitle = $row_tax_titulo->title; } } echo '<div id="menu_produtos">'; echo '</div>'; if($num_rows_content > 1 || !isset($clean_url[3])){ //Se existir mais que um produto apresenta a listagem de todos os existentes echo '<div id="products">'; echo "<h1 class='title'>".$pageTitle."</h1>"; echo '<div class="produts_list">'; $count_products = 1; ////////// IMAGENS TODAS //////////// /***************************/ if($clean_url[2]='all'){ $sel_imagem="SELECT * FROM album_images ORDER BY id"; $imagem=mysql_query($sel_imagem, $con); ?> <table width="100%"> <?php $i=0; while ($linha = mysql_fetch_assoc($imagem)) { if ($i==0) { echo '<tr>'; } echo '<td>'; echo '<table><tr><td><img src="'.$linha['imagem'].'" width="150px" height="150px"></td></tr>'; echo '<tr><td align="center"></td></tr></table>'; echo '</td>'; $i=$i+1; if ($i==4) { $i=0; } } ?> </table> <?php ;} /* ///////// IMAGENS P/ CATEG ///////// else { if($clean_url!='all'){ $sel_img_cat="SELECT * FROM album_lang"; $img_cat=mysql_query($sel_img_cat, $con); $row_img_cat=mysql_fetch_assoc($img_cat); echo 'HELL YEAH'; } } /***************************/ /* Paginação */ echo '<div class="clearfloat"></div>'; echo $navigation; // will draw our page navigation echo '<div class="clearfloat"></div>'; echo '</div>'; echo '</div>'; } echo '<div class="clearfloat"></div>'; echo '</div> <div class="clearfloat"></div>'; echo '</div> </div>'; }else{ header("Status: 404 Not Found"); header( "Location: ".$url."/".$current_lang."/pages/error/404" ); die(); } ?> Thank you, pguedes92 |
© Advanced Web Core. All rights reserved