jqplot / examples / nav.inc

<div class="nav">
  <?php
    $dh  = opendir('./');
    while (false !== ($filename = readdir($dh))) {
        if (preg_match('/^[a-z0-9][a-z0-9_\-]+\.html$/i', $filename)) {
          $files[] = $filename;
        }
    }
    $fcount = count($files);
    $parts = explode("/", $_SERVER['SCRIPT_NAME']);
    $curfile = end($parts);
    $prevfile = '';
    $nextfile = '';
    // echo $fcount, $curfile;
    // print_r($files);
    
    for ($i=0; $i<$fcount; $i++) {
      if ($curfile == $files[$i]) {
        $prevfile = $files[$i-1];
        $nextfile = $files[$i+1];
        if ($i == 0) {
          $prevfile = $files[$fcount-1];
          $nextfile = $files[1];
        }
        elseif ($i == $fcount-1) {
          $prevfile = $files[$i-1];
          $nextfile = $files[0];
        }
      }  
    }
    
    echo '<a href="'.$prevfile.'">Previous</a> <a href="./">Examples</a> <a href="'.$nextfile.'">Next</a>';
    
  ?>
</div>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.