PHP Script zur Erstellung von Webseiten
➊ Der obere Teil
<?php //lc
require_once ( $_SERVER['DOCUMENT_ROOT'] .'/style.inc.php');
css ();
headsend ();
?><!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="de" xml:lang="de">
<head>
<title><?php if ( isset ($title) ) echo $title; ?></title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<?php if ( isset ($descr) ) echo "<meta name=\"description\" content=\"$descr\">\n"; ?>
<?php if ( isset ($keywo) ) echo "<meta name=\"keywords\" content=\"$keywo\">\n"; ?>
<?php if ( isset ($robot) ) echo "<meta name=\"robots\" content=\"$robot\">\n"; ?>
<style><?php echo $buffer; if ( isset ($style) ) echo $style ?></style>
</head>
<body>
<header id="top">
<!-- Seitentitel -->
<h1><a href="/">HTML, CSS und PHP Testseiten</a></h1>
</header>
<nav>
<!-- Navigation -->
<a href="/">Startseite</a>
<a href="/html-info.php">HTML</a>
<a href="/php-info.php">PHP</a>
</nav>
➋ Die Inhaltsdatei
<?php //lc
//<head>
$title = "Tummelplatz zum Testen von Webseiten";
$descr = "Persönliches Testfeld für den Einsatz von HTML, CSS und PHP zur Erstellung von Webseiten";
$keywo = "HTML, CSS, PHP, Webseiten, Testlabor";
$robot = "index, follow";
//$style = "";
require_once ( $_SERVER['DOCUMENT_ROOT'] .'/oben.inc.php');
?>
<main id="inhalt">
<h2>Tummeplatz</h2>
<p>Willkommen auf meinem Tummelplatz zum Testen von Webseiten.</p>
</main>
<aside id="extra">
<h2>Navigation</h2>
<ul>
<li><a href="/html-info.php">HTML</a></li>
<li><a href="/php-info.php">PHP</a></li>
</ul>
</aside>
<?php require_once ( $_SERVER['DOCUMENT_ROOT'] .'/unten.inc.php'); ?>
➌ Der untere Teil
<?php //lc
// Länge
if ( strlen ($title) > 15 and strlen ($title) < 55 )
$tag_title = " class=\"pos\""; else $tag_title = " class=\"neg\"";
if ( strlen ($descr) > 140 and strlen ($descr) < 160 )
$tag_descr = " class=\"pos\""; else $tag_descr = " class=\"neg\"";
// Formular
include 'formular.php';
?>
<div id="post" class="grid" style="background: #eee">
<!-- Kommentare -->
<div>
<h2>Kommentare</h2>
<p>Schreibe den ersten <a href="#feedback">Kommentar</a></p>
</div>
<!-- Formular -->
<div>
<?php form (); ?>
</div>
</div>
<footer class="flex">
<div>
<h2>Hosting</h2>
<p>Dankbar gespeichert und ausprobiert auf den Webserven von <a href="https://www.lima-city.de/">lima-city</a>.</p>
</div>
<div>
<h2>Optimierung</h2>
<ul>
<li <?php echo $tag_title; ?> title="Optimal sind etwa zwischen 15 und 55 Zeichen"><?php echo "<title>: " . strlen ($title) . " Zeichen"; ?></li>
<li <?php echo $tag_descr; ?> title="Optimal sind etwa zwischen 140 und 160 Zeichen"><?php echo "<description>: " . strlen ($descr) . " Zeichen"; ?></li>
</ul>
</div>
</footer>
<a href="#top" class="top" title="TOP"><span style="display: block; transform: rotate(270deg)">➜</span></a>
</body>
</html>