title: simple opendir() with pagination
body: <p>I am very new in php, though was wable to make opendir() work (just show list of files in a table) now I have a problem of creating a pagination. Sorry I have been working with tutorials out there but can't make them work.I quick help would be very much appreciated.</p>
  
  <p>here's my code:</p>
  
  <pre><code>$dir = 'files/memoranda'; 
  $exclude = array('.','..','.htaccess'); 
  $y = (isset($_GET['y']))? strtolower($_GET['y']) : ''; 
  $res = opendir($dir); 
  
  while(false!== ($file = readdir($res))) { 
  if(strpos(strtolower($file),$y)!== false &amp;&amp;!in_array($file,$exclude)) { 
  echo'
      &lt;div class="Row"&gt;
          &lt;div class="Cell"&gt;
              &lt;h4&gt;&lt;a  href=" ' . $dir .  '/' . $file . ' "&gt;'.$file.'&lt;/a&gt;&lt;/h4&gt;
          &lt;/div&gt;
  
          &lt;div id="Cell" style="text-align: center;vertical-align:middle;border-top:solid 1px #cecece;"&gt;
              &lt;h4&gt;&lt;a href=" ' . $dir .  '/' . $file . ' "&gt;&lt;img style="text-align:center;padding-top:6px;" src="icon_download.png" width="30px" height="30px" &gt;&lt;/a&gt;&lt;/h4&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  ';
  
  } 
  } 
  </code></pre>