Files
beethoven2000.de/projekt-abibuch.php
T

155 lines
4.7 KiB
PHP

<?php
$file = fopen('projekt-abibuch.xml', 'r');
if (!empty($_GET['chapter']))
$chapter = $_GET['chapter'];
else
$chapter = '1-Einleitung';
// Array für die Links zu den Kapiteln
$chapterTitle = array();
// Nummer des angezeigten Kapitels
$chapterNum = -1;
// Inhalt des Kapitels
$chapterContent = '';
// Zum Kapitel springen
do {
do {
$line = fgets($file);
} while ((!feof($file)) && (substr(trim($line), 0, 8) != '<chapter'));
if (strlen($line) > 0) {
$urlTitleStart = strpos($line, 'title')+7;
$urlTitle = substr($line, $urlTitleStart, strpos($line, '"', $urlTitleStart)-$urlTitleStart);
$chapterTitle[] = $urlTitle;
$chapterNum++;
}
} while ((!feof($file)) && ($urlTitle != $chapter));
if (!feof($file)) {
// Keywords auslesen
$keywordsStart = strpos($line, 'keywords')+10;
$chapterKeywords = substr($line, $keywordsStart, strpos($line, '"', $keywordsStart)-$keywordsStart);
$descriptionStart = strpos($line, 'description')+13;
$chapterDescription = substr($line, $descriptionStart, strpos($line, '"', $descriptionStart)-$descriptionStart);
$page_title = 'Projekt Abibuch: '.strtr(substr($urlTitle, strpos($urlTitle, '-')), '-', ' ');
$additional_headers = array(
'<meta name="author" content="Tilman Walther, Martin Stadler" />',
'<meta name="keywords" content="'.$chapterKeywords.'" />',
'<meta name="description" content="'.$chapterDescription.'" />',
);
}
else {
// Kapitel existiert nicht -> Auf Anfang des Artikels umleiten
header('HTTP/1.0 301 Moved Permanently');
header('Location: http://'.$_SERVER['HTTP_HOST'].'/projekt-abibuch/');
exit;
}
// Kapitel-Inhalt in Variable speichern
while ((!feof($file)) && (trim($line = fgets($file)) != '</chapter>')) {
$chapterContent .= $line;
}
// verbleibende Kapitel-Titel auslesen
while (!feof($file)) {
do {
$line = fgets($file);
} while ((!feof($file)) && (substr(trim($line), 0, 8) != '<chapter'));
if (strlen($line) > 0) {
$urlTitleStart = strpos($line, 'title')+7;
$urlTitle = substr($line, $urlTitleStart, strpos($line, '"', $urlTitleStart)-$urlTitleStart);
$chapterTitle[] = $urlTitle;
}
}
include('includes/header.inc');
?>
<div id="content">
<img id="abibuch-illustration" src="<?php echo $http_base; ?>bilder/abibuch.png" alt="" />
<h1>Projekt Abibuch</h1>
<p class="subtitle">Eine Anleitung für Planung, Organisation und Produktion</p>
<div id="artikel-spalte">
<div class="artikel-block" id="artikel-imprint">
<strong>Version 2.1 vom 26.2.2007</strong><br />
© Tilman Walther und Martin Stadler
<img style="position:absolute; top:-1000px;" src="http://vg00.met.vgwort.de/na/05b386f973dcc8f44be1" width="1" height="1" alt="" />
</div>
<div class="artikel-block" id="artikel-navigation">
<ol>
<li><a href="1-Einleitung" <?php if ($chapterNum == 0) echo 'class="active"'; ?>>Einleitung</a></li>
<li><a href="2-Vorbereitungen" <?php if ($chapterNum == 1) echo 'class="active"'; ?>>Vorbereitungen</a></li>
<li><a href="3-Der-Jahrgang" <?php if ($chapterNum == 2) echo 'class="active"'; ?>>Der Jahrgang</a></li>
<li><a href="4-Die-Teile-des-Abibuchs" <?php if ($chapterNum == 3) echo 'class="active"'; ?>>Die Teile des Abibuchs</a></li>
<li><a href="5-Der-Verkauf" <?php if ($chapterNum == 4) echo 'class="active"'; ?>>Der Verkauf</a></li>
<li><a href="6-Werbung" <?php if ($chapterNum == 5) echo 'class="active"'; ?>>Werbung</a></li>
<li><a href="7-Rechtliches" <?php if ($chapterNum == 6) echo 'class="active"'; ?>>Rechtliches</a></li>
<li><a href="8-Technik" <?php if ($chapterNum == 7) echo 'class="active"'; ?>>Technik</a></li>
<li><a href="9-Elektronische-Medien" <?php if ($chapterNum == 8) echo 'class="active"'; ?>>Elektronische Medien</a></li>
</ol>
</div>
<!-- advertisement -->
<script type="text/javascript">
/* <![CDATA[ */
document.write('<div class="artikel-block" id="advertisement"><div class="ad-label">Anzeige:</div>');
/* ]]> */
</script>
<!-- Google AdSense -->
<script type="text/javascript">
/* <![CDATA[ */
google_ad_client = "pub-7698869955071563";
google_ad_width = 160;
google_ad_height = 600;
google_ad_format = "160x600_as";
google_ad_type = "text_image";
google_ad_channel = "";
google_color_border = "888888";
google_color_bg = "FFFFFF";
google_color_link = "5050AA";
google_color_text = "000000";
google_color_url = "008000";
/* ]]> */
</script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript">
/* <![CDATA[ */
document.write("</div>");
/* ]]> */
</script>
</div>
<div id="artikel-text">
<?php
echo $chapterContent;
if ($chapterNum < count($chapterTitle)-1) {
echo '<div class="turn-page"><a href="'.$chapterTitle[$chapterNum+1].'">weiter »</a></div>';
}
?>
</div>
</div>
<?php
include('includes/footer.inc');
?>