Changeset 88
- Timestamp:
- 27/08/06 23:46:21 (7 years ago)
- Files:
-
- 2 added
- 3 modified
-
components/contents.php (modified) (1 diff)
-
components/library.php (modified) (1 diff)
-
templates/contents-loop.tpl (added)
-
templates/contents.tpl (added)
-
templates/library.tpl (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
components/contents.php
r87 r88 1 1 <?php 2 3 function listdir($path, $recurse) { 4 $dirlist = scandir($path); 5 $output = array(); 6 foreach($dirlist as $file) { 7 if ($file!="." && $file!="..") { 8 if (!is_dir($path."/".$file)) { 9 $foo = ereg_replace("\.txt", "", $file); 10 if ($foo!=@$lastdir) $output[$foo]=$foo; 11 12 } else { 13 if ($recurse) $output[$file]=listdir($path."/".$file); 14 else $output[$file]=$file; 15 $lastdir=$file; 16 } 17 } 18 } 19 return $output; 20 } 2 21 3 22 if ($path==$component['path']) { 4 23 5 $output = "<h2>Table of Contents</h2>\n";6 24 25 $dirlist = listdir("static".$component['path'], TRUE); 26 27 $smarty->assign('rootnode', $component['path']); 28 $smarty->assign('dirlist', $dirlist); 29 $output = $smarty->fetch('contents.tpl'); 7 30 $smarty->assign('title', $pathlist[1]); 8 31 $smarty->assign('body', $output); 9 32 } else { 10 33 include("static.php"); 11 $smarty->assign("secondary", "<div class=\"cbb\"><h3>In this section</h3>\nList...</div>"); 34 $dirlist = listdir("static".$path, FALSE); 35 $smarty->assign('rootnode', $path); 36 print_r($dirlist); 37 $smarty->assign('data', $dirlist); 38 $smarty->assign('level', 0); 39 $output = $smarty->fetch('contents-loop.tpl'); 40 41 42 $smarty->assign("secondary", "<div class=\"cbb\"><h3>In this section</h3>".$output."</div>"); 12 43 } 13 44 ?> -
components/library.php
r81 r88 3 3 $mode = "list"; 4 4 5 $smarty->assign("randoms", $DB->GetAll("SELECT * FROM books ORDER BY random() LIMIT 1"));5 $smarty->assign("randoms", $DB->GetAll("SELECT * FROM books WHERE image_url IS NOT NULL ORDER BY random() LIMIT 5")); 6 6 7 7 if ($mode == "display") { 8 8 9 9 10 } 10 11 11 }12 12 $output = $smarty->fetch("library.tpl"); 13 13 $smarty->assign("title","Library"); -
templates/library.tpl
r81 r88 8 8 9 9 <h3>Random Books</h3> 10 {foreach name=randoms from=$random item=randomitem}11 <img src="{$randomitem.im g}" alt="{$randomitem.title}" />10 {foreach name=randoms from=$randoms item=randomitem} 11 <img src="{$randomitem.image_url}" alt="{$randomitem.title}" /> 12 12 {/foreach} 13 <p>Images provided by <a href="http://www.amazon.co.uk">Amazon</a></p>
