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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.