Total <?= $Num_Rows;?> Record : <?=$Num_Pages;?> Page : <? if($Prev_Page) { echo " <a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page&start=$start&end=$end&status=$status&pay_channel=$pay_channel'><< Back</a> "; } for($i=1; $i<=$Num_Pages; $i++){ if($i != $Page) { echo "[ <a href='$_SERVER[SCRIPT_NAME]?Page=$i&start=$start&end=$end&status=$status&pay_channel=$pay_channel'>$i</a> ]"; } else { echo "<b> $i </b>"; } } if($Page!=$Num_Pages) { echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page&start=$start&end=$end&status=$status&pay_channel=$pay_channel'>Next>></a> "; }
<?php echo new pageNavigation('gallery.php',$lastpage); // หน้า 1 | 2 | 3 // ex. <a href='galelry.php?page=1'>1</a> echo new pageNavigation('gallery.php',$lastpage,array('type'=>'system')); // หน้า 1 | 2 | 3 // ex. <a href='galelry.php?type=system&page=1'>1</a> echo new pageNavigation('gallery.php',$lastpage,array('type'=>'system','owner'=>'admin')); // หน้า 1 | 2 | 3 // ex. <a href='galelry.php?type=system&owner=admin&page=1'>1</a> ?>
<?php $perPage = 10; //จำนวน record ที่ต้องการให้แสดงต่อหน้า $count = mysql_num_rows($result); $lastpage = ceil(count/$perPage); ?>
<?php /*! * Copyright 2010, Manosate Pipatpatama *********************************************** * website: http://labworks.in.th/ * facebook: http://facebook.com/manosate/ * twitter: http://twitter.com/manosate * */ class pageNavigation{ private $link; private $lastPage; private $attrs; function __construct($link, $lastPage, $attrs = array()){ $this->link = $link; $this->lastPage = $lastPage; $this->attrs = $attrs; } function __toString(){ $str = "<div class='page_navigator'>"; $str.= "<strong>หน้า:</strong>"; for($page=1; $page<=$this->lastPage; $page++){ $firstAttr = true; $str.= " <a href='".$this->link; foreach($this->attrs as $name => $val){ if($firstAttr){ $firstAttr = false; $str.= '?'; } else $str.= '&'; $str.= $name.'='.$val; } if($firstAttr){ $firstAttr = false; $str.= '?'; } else $str.= '&'; $str.= "page=".$page."'>".$page."</a> "; if($page<$this->lastPage) $str.= " | "; } $str.= "</div>"; return $str; } } ?>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง