Subversion-Projekte lars-tiefland.ci

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
875 lars 1
<div class="example-nav">
2
  <?php
3
    $tmpnames = scandir('./');
4
    $skip = array('opener.php', 'bodyOpener.php', 'nav.php', 'closer.html', 'commonScripts.html', 'topbanner.html');
5
 
6
    foreach( $tmpnames as $value) {
7
        if (preg_match('/^[a-z0-9][a-z0-9_\-]+\.(html|php)$/i', $value)) {
8
          if (! in_array($value, $skip)) {
9
            $files[] = $value;
10
          }
11
        }
12
    }
13
    $fcount = count($files);
14
    $parts = explode("/", $_SERVER['SCRIPT_NAME']);
15
    $curfile = end($parts);
16
    $prevfile = '';
17
    $nextfile = '';
18
    // print_r($files);
19
 
20
    for ($i=0; $i<$fcount; $i++) {
21
      if ($curfile == $files[$i]) {
22
        if ($i == 0) {
23
          $prevfile = $files[$fcount-1];
24
          $nextfile = $files[1];
25
        }
26
        elseif ($i == $fcount-1) {
27
          $prevfile = $files[$i-1];
28
          $nextfile = $files[0];
29
        }
30
        else {
31
          $prevfile = $files[$i-1];
32
          $nextfile = $files[$i+1];
33
        }
34
      }
35
    }
36
 
37
    echo '<a href="'.$prevfile.'">Previous</a> <a href="./">Examples</a> <a href="'.$nextfile.'">Next</a>';
38
 
39
  ?>
40
</div>