Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- include_once('db.php');
- //include "includes/MysqlConnect.php";
- //$con = MysqlConnect::getInstance();
- $a=$_GET['result'];
- $query="select plot_detailsid from plot_details where cid=17";
- $res = mysqli_query($connection,$query);
- $count = mysqli_fetch_array($res);
- $page = (int) (!isset($_REQUEST['pageId']) ? 1 :$_REQUEST['pageId']);
- $page = ($page == 0 ? 1 : $page);
- $recordsPerPage = 3;
- $start = ($page-1) * $recordsPerPage;
- $adjacents = "2";
- $prev = $page - 1;
- $next = $page + 1;
- $lastpage = ceil($count/$recordsPerPage);
- $lpm1 = $lastpage - 1;
- $pagination = "";
- if($lastpage > 1)
- {
- $pagination .= "<div class='pagination'>";
- if ($page > 1)
- $pagination.= "<a href=\"#Page=".($prev)."\" onClick='changePagination(".($prev).");'>« Previous </a>";
- else
- $pagination.= "<span class='disabled'>« Previous </span>";
- if ($lastpage < 7 + ($adjacents * 2))
- {
- for ($counter = 1; $counter <= $lastpage; $counter++)
- {
- if ($counter == $page)
- $pagination.= "<span class='current'>$counter</span>";
- else
- $pagination.= "<a href=\"#Page=".($counter)."\" onClick='changePagination(".($counter).");'>$counter</a>";
- }
- }
- elseif($lastpage > 5 + ($adjacents * 2))
- {
- if($page < 1 + ($adjacents * 2))
- {
- for($counter = 1; $counter < 4 + ($adjacents * 2); $counter++)
- {
- if($counter == $page)
- $pagination.= "<span class='current'>$counter</span>";
- else
- $pagination.= "<a href=\"#Page=".($counter)."\" onClick='changePagination(".($counter).");'>$counter</a>";
- }
- $pagination.= "...";
- $pagination.= "<a href=\"#Page=".($lpm1)."\" onClick='changePagination(".($lpm1).");'>$lpm1</a>";
- $pagination.= "<a href=\"#Page=".($lastpage)."\" onClick='changePagination(".($lastpage).");'>$lastpage</a>";
- }
- elseif($lastpage - ($adjacents * 2) > $page && $page > ($adjacents * 2))
- {
- $pagination.= "<a href=\"#Page=\"1\"\" onClick='changePagination(1);'>1</a>";
- $pagination.= "<a href=\"#Page=\"2\"\" onClick='changePagination(2);'>2</a>";
- $pagination.= "...";
- for($counter = $page - $adjacents; $counter <= $page + $adjacents; $counter++)
- {
- if($counter == $page)
- $pagination.= "<span class='current'>$counter</span>";
- else
- $pagination.= "<a href=\"#Page=".($counter)."\" onClick='changePagination(".($counter).");'>$counter</a>";
- }
- $pagination.= "..";
- $pagination.= "<a href=\"#Page=".($lpm1)."\" onClick='changePagination(".($lpm1).");'>$lpm1</a>";
- $pagination.= "<a href=\"#Page=".($lastpage)."\" onClick='changePagination(".($lastpage).");'>$lastpage</a>";
- }
- else
- {
- $pagination.= "<a href=\"#Page=\"1\"\" onClick='changePagination(1);'>1</a>";
- $pagination.= "<a href=\"#Page=\"2\"\" onClick='changePagination(2);'>2</a>";
- $pagination.= "..";
- for($counter = $lastpage - (2 + ($adjacents * 2)); $counter <= $lastpage; $counter++)
- {
- if($counter == $page)
- $pagination.= "<span class='current'>$counter</span>";
- else
- $pagination.= "<a href=\"#Page=".($counter)."\" onClick='changePagination(".($counter).");'>$counter</a>";
- }
- }
- }
- if($page < $counter - 1)
- $pagination.= "<a href=\"#Page=".($next)."\" onClick='changePagination(".($next).");'>Next »</a>";
- else
- $pagination.= "<span class='disabled'>Next »</span>";
- $pagination.= "</div>";
- }
- if(isset($_POST['pageId']) && !empty($_POST['pageId']))
- {
- $id=$_POST['pageId'];
- }
- else
- {
- $id='0';
- }
- $query="select * from plot_details where cid= $a
- limit ".mysqli_real_escape_string($connection,$start).",$recordsPerPage";
- //echo $query;
- $res = mysqli_query($connection,$query);
- $count = mysqli_fetch_array($res);
- $HTML='';
- ?>
- <div class="mod">
- <div id="grid-product"> <?php if($count > 0)
- {
- while($row=mysqli_fetch_array($res))
- {
- $title=$row['title'];
- $content=$row['content'];
- $covered_area=$row['covered_area'];
- $feet=$row['feet'];
- $city=$row['city'];
- $locality=$row['locality'];
- $imgname=$row['imgname'];
- $random_id=$row['random_id'];
- $price=$row['price'];
- $plot_detailsid=$row['plot_detailsid'];
- ?> <?php //foreach($sql as $row){?>
- <table role="grid" style="height: auto;"> <tbody role="rowgroup">
- <div class="list-view featured">
- <div class="img-wrapper">
- <a href="pdetail.php?result=<?php echo $plot_detailsid;?>" link="public/images/thumbs/<?php echo $imgname;?>" title="3 Photos"><img src="public/images/<?php echo $imgname;?>" border="0" class="thumb" height="100" width="100"></a>
- </div>
- <div class="details">
- <h3><a href="pdetail.php?result=<?php echo $plot_detailsid;?>" title="<?php echo $title;?>"><?php echo $title;?></a></h3>
- <?php
- $string=$content;
- $string = strip_tags($string);
- if (strlen($string) > 200) {
- // truncate string
- $stringCut = substr($string, 0, 200);
- // make sure it ends in a word so assassinate doesn't become ass...
- $string = substr($stringCut, 0, strrpos($stringCut, ' '));
- }
- ?>
- <?php echo $string;?> <br>
- <span>Area: </span> <?php echo $covered_area; ?> <?php echo $feet;?> <span>Location: </span><?php echo $city;?> ,<?php echo $locality;?> <br>
- </div>
- <div class="info spacer">
- <span>Property ID :</span><?php echo $random_id;?>
- <hr>
- <div class="call"> RS:<?php echo $price;?> </div>
- </div>
- <hr>
- <span class="contact"><a href="#">Contact</a></span>
- <span class="write-review"><a href="#">Write a review</a></span> |
- <a href="#">More Photos</a> |
- <a href="pdetail.php?result=<?php echo $plot_detailsid;?>">View Details</a>
- </div><?php //} ?>
- <div id="pageData"></div>
- <div id="grid-product">
- </tbody></table></div>
- </div>
- <?php
- }
- }
- else
- {
- $HTML='No Data Found';
- }
- echo $HTML;
- echo $pagination;
- ?>
- <script type="text/javascript">
- $(document).ready(function(){
- changePagination('0');
- });
- function changePagination(pageId){
- $(".flash").show();
- $(".flash").fadeIn(400).html
- ('Loading <img src="ajax-loader.gif" />');
- var dataString = 'pageId='+ pageId;
- $.ajax({
- type: "POST",
- url: "product_list.php",
- data: dataString,
- cache: false,
- success: function(result){
- $(".flash").hide();
- $("#pageData").html(result);
- }
- });
- }
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement