PHP Split Results (Paginate)

Does anybody know the script boonex uses for the videos and all modules pages that Paginate the results of the table and display page links to the user? I have been struggling for a while to find out what file it's in, or what it would even look like.

 

Thanks!

Quote · 18 Jun 2012

inc/classes/BxDolPaginate.php


https://www.deanbassett.com
Quote · 18 Jun 2012

This all looks like it is written in an alien language! Sorry, but this really doesn't help. Where would I even start? How could I use my database, "_Games" with the table "all-games" to use this for a game section of my website? Where would I put the content that one row of the table gets displayed? 

Quote · 18 Jun 2012

RE:  Where would I even start?

 

You can start by precisely explaining what you really want to do.

My opinions expressed on this site, in no way represent those of Boonex or Boonex employees.
Quote · 18 Jun 2012

Okay, Precisely, I am trying to Paginage this page:

http://my-cabinet.com/games/adventure

Here is what I have so far: (And it doesnt work at all, so I am looking at using Dolphins base Paginate script)

 

<?
 
include_once ("games/templates/base/template2/mysql_connect.php");
include_once ("games/templates/base/head.php");
 
$per_page = '1000';
// Let's put FROM and WHERE parts of the query into variable
$from_where="FROM Games WHERE category ='$category_code'";
// and get total number of records
$sql = "SELECT count(*) ".$from_where;
$res = mysql_query($sql) or trigger_error(mysql_error()." in ".$sql);
$row = mysql_fetch_row($res);
$total_rows = $row[0];
 
//let's get page number from the query string 
if (isset($_GET['page'])) $CUR_PAGE = intval($_GET['page']); else $CUR_PAGE=1;
//and calculate $start variable for the LIMIT clause
$start = abs(($CUR_PAGE-1)*$per_page);
 
//Let's query database for the actual data
$sql = "SELECT * $from_where ORDER BY id DESC LIMIT $start,$per_page";
$res = mysql_query($sql) or trigger_error(mysql_error()." in ".$sql);
// and fill an array
while ($row=mysql_fetch_array($res)) $DATA[++$start]=$row;
 
//now let's form new query string without page variable
$uri = '/games/' . $category_code;    
$tmpget = $_GET;
unset($tmpget['page']);
if ($tmpget) {
  $uri .= http_build_query($tmpget)."&";
}    
//now we're getting total pages number and fill an array of links
$num_pages=ceil($total_rows/$per_page);
for($i=1;$i<=$num_pages;$i++) $PAGES[$i]=$uri.'page='.$i;
 
//and, finally, starting output in the template.
?>
Pages: 
<? foreach ($PAGES as $i => $link): ?>
<? if ($i == $CUR_PAGE): ?>
<b><?=$i?></b>
<? else: ?> 
<a href="<?=$link?>"><?=$i?></a>
<? endif ?> 
<? endforeach ?> 
<br/>
<? foreach ($DATA as $i => $row): ?>
 <center><div id="gamebuttonwidget" class="widget widget-74 rounded">
     <a href="http://my-cabinet.com/games/play/<?=$row['pagename']?>"><p><span class="hotspot"><img class="imagesinbuttons" alt="<?=$row['title']?>" src="<?=$row['image_name']?>" width="172px"/><br/><?=$row['title']?></span></p></a>
    </div></center>
 
<? endforeach ?> 
 

I would like to just get data from my database, and display each row as:

 <center><div id="gamebuttonwidget" class="widget widget-74 rounded">
     <a href="http://my-cabinet.com/games/play/<?=$row['pagename']?>"><p><span class="hotspot"><img class="imagesinbuttons" alt="<?=$row['title']?>" src="<?=$row['image_name']?>" width="172px"/><br/><?=$row['title']?></span></p></a>

    </div></center>

Then, once the results get past for example, say, 20, the page navigation would display a "page 2" where rows 21 - 40 are displayed. And so on. 

 

 

Quote · 18 Jun 2012
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.