Creates a fully page navigation used in the PHPFusion System. With the given parameters you can in a few easy steps build a page navigation for your Infusions or mods for PHPFusion.
Quote
makepagenav ( int $start, int $count, int $total [, int $range [, string $link [, string $getname ] ] ] )
<?php
// Set the number of how many items you want to display
// at one page
$items_per_page = 10;
// Here we check for the $_GET['rowstart'] variable and
// set it to 0 if it is not set already
if (!isset($_GET['rowstart']) || !isnum($_GET['rowstart'])) {
$_GET['rowstart'] = 0;
}
// Count the total number of rows in the table with the given
// condition(s). In this example the conditions are field1='this'
$rows = dbcount("(field)", TABLE_NAME, "field1='this'");
// Display the results from $_GET['rowstart'] and the next 10
// items ($items_per_page)
$result = dbquery(
"SELECT field FROM ".TABLE_NAME."
WHERE field1='this'
LIMIT ".$_GET['rowstart'].",$items_per_page"
);
while($data = dbrows($result)) {
// Items will go here
}
// If there are more rows than the number of items (10) in
// the table we display the makepagenav()
if ($rows > $items_per_page) {
echo makepagenav($_GET['rowstart'], $items_per_page, $rows, 3);
}
?>
<?php
// Here we'll use the same code from the example above
// except the line where we output the makepagenav
// function. Make sure you do not forget the & at the
// end or this function will not work correctly!
echo makepagenav($_GET['rowstart'], $items_per_page, $rows, 3, FUSION_SELF."?this=that&");
?>
<?php
// Here we'll use the same code from the example above
// except the line where we output the makepagenav
// function. Make sure you do not forget the & at the
// end or this function will not work correctly!
echo makepagenav($_GET['rowstart'], $items_per_page, $rows, 3, FUSION_SELF."?this=that&", "rowstart");
// Here comes some other code
// and then the second makepagenav
// in this example we use the code frorm the comments' nav
echo makepagenav($_GET['c_start'], $cpp, $c_rows, 3, $clink."&", "c_start");
?>