Aufgabe 2


Seiten erstellen

- Die Datei "index.tpl" wurde in "page_1.tpl" umbenannt und dupliziert zu "page_2.tpl".

Screenshot
Inhalt der Datei "index.php" <?php /** * Example Application * * @package Example-application */ require '../libs/Smarty.class.php'; $smarty = new Smarty; $smarty->force_compile = true; $smarty->debugging = false; $smarty->caching = false; $smarty->cache_lifetime = 120; $current_page = isset( $_GET['page'] ) ? $_GET['page'] : 'page_1'; if( $current_page == 'page_2' ){ $arr_files = scandir( "./mein_uploadverzeichnis/" ); // print_arr( $arr_files ); $smarty->assign('arr_files', $arr_files); } $smarty->display( $current_page . '.tpl' ); // Debug function print_arr( $arr ){ echo '<pre>'; print_r( $arr ); echo '</pre>'; } ?>
Inhalt der Datei "header.tpl" <HTML> <HEAD> <TITLE></TITLE> </HEAD> <BODY bgcolor="#ffffff"> <a href="./index.php?page=page_1">Seite 1</a> <a href="./index.php?page=page_2">Seite 2</a> <hr />
Inhalt der Datei "page_1.tpl" {config_load file="test.conf" section="page_1"} {include file="header.tpl" title=foo} <input type="file" id="input" class="" style="border:0px;" multiple="multiple"> <input type="button" value=" &Uuml;bertragen " id="input_button"> {*include file="footer.tpl"*}
Inhalt der Datei "page_2.tpl" {config_load file="test.conf" section="page_2"} {include file="header.tpl" title=foo} <p>Dateien:</p> {foreach key=i item=file from=$arr_files} {$file}<br> {/foreach} {*include file="footer.tpl"*} Screenshot
Screenshot