/logo.gif

... in Bearbeitung...

ktemplate-1

[zurück]

Menü


ganz alte news...

Am 1.1.1970 begann um 1:00 Uhr die Unixzeitrechnung.


Damit sich das Template in meine Präsentation einfügen läßt,
verwende ich nur den Block MAIN.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<head>
<title>K&uuml;rbis Template</title>
</head>

<body>

<!-- BEGIN MAIN -->
<h4>Men&uuml;</h4>
<ul>
<!-- BEGIN MENU -->
<li><a href="{MENU_LINK}">{MENU_DESC}</a></li>
<!-- END MENU -->
</ul>
<hr>
{CONTENT}

<!-- END MAIN -->

</body>
</html>

news.php

<?php

$content 
'
<h4>ganz alte news...</h4>
<p>Am 1.1.1970 begann um 1:00 Uhr die Unixzeitrechnung.</p>
'
;

?>
Laufzeit: 1800.876 ms

index.php
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: <?php


define
('RUN'true);
define('tpl''./index.tpl');
define('menulink'$_SERVER['SCRIPT_NAME'] . '?view=%s');

# classfile wird via __autoload() geladen.
# require_once './class_ktemplate.inc.php';

/****************************************************
# KTemplate ist von Ralf Geschke: http://kuerbis.org
*****************************************************/

$menu = array(
'news' => 'News',
'impressum' => 'Impressum');

# Uservariable überprüfen

if (isset($_GET['view']) AND ! empty($_GET['view']))
{
    if (! 
array_key_exists($_GET['view'], $menu))
        
$_GET['view'] = '';
}

if (! isset(
$_GET['view']) OR empty($_GET['view']))
{
    
$_GET['view'] = 'news';
}

####

include './' $_GET['view'] . '.php';

### ab hier beinhaltet $content den anzuzeigenden Text.

$t = new KTemplate(tpl);
$t_main $t->MAIN;

# Content eintragen

$t_main->CONTENT $content;

# Menü basteln

$t_menu $t_main->MENU;

foreach(
$menu AS $var => $val)
{
    
$t_menu->MENU_LINK sprintf(menulink$var);
    
$t_menu->MENU_DESC $val;
    
$t_main->MENU $t_menu->get();
    
$t_menu->reset();
}

# ausgeben

$t_main->out();

print 
'<hr>';

# Anzeige des unbearbeiteten Templates
print '<h5>Damit sich das Template in meine Präsentation einfügen l&auml;&szlig;t, <br />
verwende ich nur den Block MAIN.</h5>'
;

print(
nl2br(htmlentities(file_get_contents(tpl))));

print 
'<hr>';

# Anzeige des jeweiligen Contentfiles
printf('<h4>%s.php</h4>'$_GET['view']);
highlight_file('./' $_GET['view'] . '.php');

?>
########################
#
# Autor:   meikel at php minus help dot info
#
# The contents of this file are subject to the Mozilla Public License
# Version 1.1 (the "License"); you may not use this file except in
# compliance with the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS"
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
# License for the specific language governing rights and limitations
# under the License.
##########################