Esempio n. 1
0
 function __construct($num, $total)
 {
     self::$url = $_SERVER['SCRIPT_NAME'] . '/' . $_GET['m'] . '/' . $_GET['a'];
     self::$num = $num;
     self::$total = $total;
     self::$pages = ceil(self::$total / self::$num);
     self::$page = empty($_GET['page']) || $_GET['page'] <= 1 ? 1 : ($_GET['page'] > self::$pages ? self::$pages : (int) $_GET['page']);
     self::$prevNum = self::$page <= 1 ? FALSE : self::$page - 1;
     self::$nextNum = self::$page >= self::$pages ? FALSE : self::$page + 1;
     self::$offset = (self::$page - 1) * self::$num;
     //		self::$limit 		= ' where id > ' . ceil(self::$offset/2) . ' limit ' . self::$offset . ',' . self::$num ;
     self::$limit = self::$offset . ',' . self::$num;
 }
 /**
  *  Main function
  */
 public static function main()
 {
     Pages::$pages = new Table('pages');
     Pages::$page = Pages::pageLoader();
 }