Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $YPATH="ypathfile";
- $gambar0="avatar.jpg";
- $PATH="galeri/cssgaleri";
- $YPATH="ypathfile";
- $PATH0="ypathcss";
- $kat=isset($_GET["kat"])?$_GET["kat"]:"";
- $where=(empty($kat))?"":"where `id-kategori`='$kat'";
- $query = mysql_query("SELECT * FROM `$tbproduk` $where");
- $jmldata = mysql_num_rows($query);
- ?>
- <link rel="stylesheet" type="text/css" href="<?php echo $PATH0."/".$css;?>" />
- <link rel="stylesheet" type="text/css" href="<?php echo $PATH; ?>/tips-basic.css" />
- <style type="text/css">
- .polos,.polos tr,.polos td {border:0px;}
- </style>
- <script type="text/javascript" src="<?php echo $PATH; ?>/jquery.tools.min.js"></script>
- <script type="text/javascript">
- $(document).ready(function(){
- $("#tools img[title]").tooltip('#tooltip');
- });
- function buka(url) {window.open(url, "window_baru", "width=800,height=600,left=320,top=100,resizable=1,scrollbars=1");}
- </script>
- <div style="position: absolute; top: 38px; left: 237px; display: none;" id="tooltip"></div>
- <div id="tools">
- <?php
- $sql="SELECT * FROM `$tbproduk` WHERE `hits`>'0' ORDER BY RAND()";
- $query=mysql_query($sql);
- $jum=mysql_num_rows($query);
- if($jum > 0){
- //--------------------------------------------------------------------------------------------
- $batas = 8; // number of product per page
- $column = 4; // number of product per row
- $page = isset($_GET['page'])?$_GET['page']:1;
- $posawal=($page-1) * $batas;
- $sql .= " LIMIT $posawal,$batas";
- $q2 = mysql_query($sql);
- $no = $posawal+1;
- //--------------------------------------------------------------------------------------------
- $i=0;
- echo "<table class=\"polos\">\n";
- while ($w = mysql_fetch_array($q2)) {
- echo ($i==0?"<tr>":"");
- $i++;
- $harga=RP($w["harga"]);
- echo "<td align=\"center\">"
- ."<a href='?mnu=produkdetailorder&id=".$w["id-produk"]."'>"
- ."<img src='$YPATH/".$w["gambar"]."' border='0' alt='".$w["gambar"]."' width='120' height='100' "
- ."title='".$w["nama-produk"]." (".KAT($tbkategori,$w["id-kategori"])."),Harga Rp.$harga<br>stok : ".$w[$ket2].". ".substr($w["keterangan"],0,100)."'>"
- ."</a><br>"
- ."Ukuran ".$w['ukuran']."<br>"
- ."Harga Rp.$harga"
- ."</td>";
- if($i%$column==0){
- echo "</tr>\n";
- $i=0;
- }
- }
- if($i>0){
- echo "<td colspan=\"".($column-$i)."\"> </td></tr>\n";
- }
- echo "</table>";
- //Langkah 3: Hitung total data dan page
- if($jmldata>0){
- $jmlhal = ceil($jmldata/$batas);
- echo "<div align=left>";
- if($page > 1){
- $prev=$page-1;
- echo "<span class=prevnext><a href='$_SERVER[PHP_SELF]?page=$prev&mnu=produk'>« Prev</a></span> ";
- }else{
- echo "<span class=disabled>« Prev</span> ";
- }
- // Tampilkan link page 1,2,3 ...
- for($i=1;$i<=$jmlhal;$i++){
- if ($i != $page){
- echo "<a href='$_SERVER[PHP_SELF]?page=$i&mnu=produk'>$i</a> ";
- }else{
- echo " <span class=current>$i</span> ";
- }
- }
- // Link kepage berikutnya (Next)
- if($page < $jmlhal){
- $next=$page+1;
- echo "<span class=prevnext><a href='$_SERVER[PHP_SELF]?page=$next&mnu=produk'>Next »</a></span>";
- } else{
- echo "<span class=disabled>Next »</span>";
- }
- echo "</div>";
- }//if jmldata
- }//if jum>0
- echo "<p align=left>total $usaha <b>$jmldata</b> Data</p>";
- ?>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement