Jump to content

max of 10 per page


Recommended Posts

i have my code that includes all pages in my directory but how do i get it to only show 10 on each page.

 

This is my code

<?php
    $moduleHandle = opendir('games/');
    $x = 1;
    while(false !== ($moduleFile = readdir($moduleHandle))){
        if($moduleFile == "." || $moduleFile == ".." || $moduleFile == "demo.html" || $moduleFile == "..." || $moduleFile == "navigation.php")continue;
// replace unused with any files you dont want to be included
      include("games/$moduleFile");

        $x++;
    }

    if($showBack == "process"){
        echo"Files Loaded Successfully: <b>$x</b><br>";
    }
    closedir($moduleHandle);
?>

 

Thankyou for all the help

 

One more thing if you don't mind how do i make a next page link / button.

 

Thankyou all very much.

 

 

Link to comment
https://forums.phpfreaks.com/topic/104896-max-of-10-per-page/
Share on other sites

Have a search for a pagination tutorial. You'll mostly come across these for mysql results, but the principles are the same. You'll need to read your includes into an array in the same order each time, then only use a selection of those for display depending on the page number.

Link to comment
https://forums.phpfreaks.com/topic/104896-max-of-10-per-page/#findComment-536827
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.