Table Pagination/Row Limiting?

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
jonathantheaker
Forum Newbie
Posts: 14
Joined: Fri Apr 23, 2010 2:48 pm
Location: Huddersfield, West Yorkshire, England, United Kingdom, Earth.

Table Pagination/Row Limiting?

Post by jonathantheaker »

Hi

Ive been working on a script that gathers info about item prices from a MMORPG fansite i run, it basicly scrapes info from the game creators site and saves that data to a text file. I'm now trying to display that data, i have gotten this far but have hit a bit of a brick wall, i need to be able to add some sort of Pagination or limit the script to add Pagination after every 50th row of the table.

The table has over 3000 rows so i need to limit it from all being loaded untill it needs to be ie; the user changes page via Pagination.

Any help anyone can offer would be great.

Heres the code im working with and a working example (beware: teake a while to load) http://www.hintscape.net/scripts/hs_ge.php

Code: Select all

<?php
$timestamp = file_get_contents('http://hintscape.net/scripts/output/last_updated.txt');  
$data = file('http://hintscape.net/scripts/output/prices_' . $timestamp . '.txt');

      echo '<table border="1" cellpadding="4" style="border-collapse: collapse" bordercolor="#000000">'
                        .'<tr>'
                        .'<td colspan="4">Grand Exchnage</td>'
                        .'</tr>'
                        .'<tr>'
                        .'<td>Image</td>'
                        .'<td>Name</td>'
                        .'<td>Current Price</td>'
                        .'<td>Change Today</td>'
                        .'</tr>';

foreach ($data as $line) {
	list($id, $name, $price, $change) = explode("\t", $line);
	echo '<tr>'
	    .'<td><img border="0" src="http://images.hintscape.net/hs_ge/' . $id . '.gif"></td>'
	    .'<td>' . $name . '</td>'
	    .'<td>' . $price . '</td>'
	    .'<td>' . $change . '</td>';
	
}
	echo '</tr>';
	echo '</table><br>';

?>
Post Reply