Problem mit 2 PHP include() Datein
Hallo zusammen,
Ich habe ein Problem:
Und zwar habe ich für einen Freund eine Seite erstellt (mittels einer Vorlage).
Nun möchte mein Freund noch einen Kalender in der linken menüleiste eingebaut haben.
Der Kalender ist in einer php Datei auf dem Server.
Diese habe ich mit php include auf meine Hauptseite eingebunden.
Da sich auch noch das Hauptfenster über php include steuern lässt, kommt es irgendwie zu einem Fehler.
Hier könnt ihr euch den Fehler mal anschauen:
shin.crystalblood.de
So sollte die Seite eigentlich ausschauen:
http://www.hilfe-forum.eu/imgcache/4818.imgcache
Hier sind einmal die Kalender Datei (kalender2.php) und die Datei von der Hauptseite (index.php) auf der alles eingebunden ist:
HTML-Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Lore Ipsum</title>
<style type="text/css">
<!--
body {
font: 100%/1.4 Verdana, Arial, Helvetica, sans-serif;
background: #42413C;
margin: 0;
padding: 0;
color: #000;
}
/* ~~ Element-/Tag-Selektoren ~~ */
ul, ol, dl {
padding: 0;
margin: 0;
}
h1, h2, h3, h4, h5, h6, p {
margin-top: 0;
padding-right: 15px;
padding-left: 15px;
}
a img {
border: none;
}
a:link {
color: #42413C;
text-decoration: underline;
}
a:visited {
color: #6E6C64;
text-decoration: underline;
}
a:hover, a:active, a:focus {
text-decoration: none;
}
.container {
width: 960px;
background: #FFF;
margin: 0 auto;
}
.header {
background: #ADB96E;
}
.sidebar1 {
float: left;
width: 250px;
background: #EADCAE;
padding-bottom: 10px;
}
.content {
padding: 10px 0;
width: 710px;
float: left;
}
.content ul, .content ol {
padding: 0 15px 15px 40px;
}
ul.nav {
list-style: none;
border-top: 1px solid #666;
margin-bottom: 15px;
}
ul.nav li {
border-bottom: 1px solid #666;
}
ul.nav a, ul.nav a:visited {
padding: 5px 5px 5px 15px;
display: block;
width: 230px;
text-decoration: none;
background: #C6D580;
}
ul.nav a:hover, ul.nav a:active, ul.nav a:focus {
background: #ADB96E;
color: #FFF;
}
.footer {
padding: 10px 0;
background: #CCC49F;
position: relative;
clear: both;
}
.fltrt {
float: right;
margin-left: 8px;
}
.fltlft {
float: left;
margin-right: 8px;
}
.clearfloat {
clear:both;
height:0;
font-size: 1px;
line-height: 0px;
}
.impressum {
padding: 5px 5px 5px 15px;
display: block;
width: 180px;
text-decoration: none;
background: #C6D580;
border: 1px solid #666;
margin-bottom: 15px;
}
-->
</style></head>
<body>
<div class="container">
<div class="header"><a href="#"><img src="banner.jpg" alt="logo" name="logo" width="961" height="150" id="logo" style="background: #C6D580; display:block;" /></a>
<!-- end .header --></div>
<div class="sidebar1">
<ul class="nav">
<li><a href="index.php?go=startseite">Startseite</a></li>
<li><a href="index.php?go=termine">Termine</a></li>
<li><a href="index.php?go=bilder">Bilder</a></li>
<li><a href="index.php?go=kontakt">Kontakt</a></li>
<li><a href="index.php?go=anfahrt">Anfahrt</a></li>
</ul>
<p> <?php include("kalender2.php");
?>
</p>
<!-- end .sidebar1 --></div>
<div class="content">
<?php
if (isset($_GET['go']))
{
switch($_GET['go'])
{
case 'startseite': include('startseite.html');
break;
case 'termine': include('termine.html');
break;
case 'bilder': include('bilder.html');
break;
case 'kontakt': include('kontakt.html');
break;
case 'anfahrt': include('anfahrt.html');
break;
case 'impressum': include('impressum-inaktiv.html');
break;
default: include('startseite.html');
}
}
else
{
include('startseite.html');
}
?></p>
<!-- end .content --></div>
<div class="footer">
<p>Copyright by the_zoker_09 <div align="right"><a href="index.php?go=impressum">Impressum</a></div></p>
<!-- end .footer --></div>
<!-- end .container --></div>
</body>
</html>
HTML-Code:
<style type="text/css">
body, a, td, th {
font-family: Verdana, Arial; font-size: 13px;
}
a, a:visited {
color: #DD0000;
}
</style>
<center>
<?php
// Terminkalender - Kalender
require_once("einstellungen.inc.php");
$monat = date("n");
$jahr = date("Y");
if ($_GET) {
$_GET["monat"] = $_GET["monat"] < 10 ? (ereg_replace("^0", "", $_GET["monat"])) : $_GET["monat"];
$jahr = (($_GET["monat"] > 12) ? ($_GET["jahr"] + 1) : (($_GET["monat"] < 1) ? (trim($_GET["jahr"]) - 1) : trim($_GET["jahr"])));
$monat = trim((($_GET["monat"] < 1) ? 12 : (($_GET["monat"] > 12) ? 1 : $_GET["monat"])));
}
$monatsname = strftime("%B", mktime(0, 0, 0, $monat, 1, $jahr));
$monatminus = $monat - 1; $monatplus = $monat + 1;
$jahrminus = $jahr - 1; $jahrplus = $jahr + 1;
echo <<<EOT
<script type="text/javascript">
function gehe_zu(datum) {
if (datum != null) {
var d = datum.split(",");
if (d[0] < 13 && d[1] > 1901 && d[1] < 2038) {
window.location.href="?monat=" + d[0] + "&jahr=" + d[1] + "";
}
}
}
</script>
<table border="0" cellPadding="6" cellSpacing="1">
<caption style="white-space: Nowrap;">
<strong>$terminkalender</strong>
<a href="?monat=$monatminus&jahr=$jahr" title="Einen Monat zurück" style="text-decoration: None;">←</a>
$monatsname
<a href="?monat=$monatplus&jahr=$jahr" title="Einen Monat vorwärts" style="text-decoration: None;">→</a>
<a href="?jahr=$jahrminus&monat=$monat" title="Ein Jahr zurück" style="text-decoration: None;">←</a>
$jahr
<a href="?jahr=$jahrplus&monat=$monat" title="Einen Jahr vorwärts" style="text-decoration: None;">→</a>
</caption>
<tr style="background-color: $tabellenkopf_hintergrund;">
<th>Mo</th><th>Di</th><th>Mi</th><th>Do</th><th>Fr</th><th>Sa</th><th>So</th>
</tr>
<tr style="background-color: $zellenhintergrund_dunkel;">
EOT;
$zelle = array_fill(0, 7, " ");
$zelle = array_splice($zelle ,0 , (date("w", mktime(0, 0, 0, $monat, 1, $jahr)-1)));
if (file_exists($termindatei)) {
$dateiinhalt = file($termindatei);
}
else {
exit("<strong>Die Datei \"$termindatei\" ist nicht vorhanden!</strong>");
}
for ($tag = 1; $tag <= (date("t", mktime(0, 0, 0, $monat, 1, $jahr))); $tag++) {
$ty = false;
$tring = "";
foreach ($dateiinhalt as $element) {
list($datum, $b, $c, $d, $e, $id) = explode("|", $element);
$m = ($monat < 10 ? "0" : "") . $monat;
$t = ($tag < 10 ? "0" : "") . $tag;
if ($datum == "$jahr.$m.$t") {
if (!strstr($tring, "$jahr.$monat.$tag")) {
$heute = ($tag == date("j") && $monat == date("n") && $jahr == date("Y")) ? "<span style=\"background-color: $zellenhintergrund_highlight;\">$tag</span>" : $tag;
array_push($zelle, "<a href=\"?monat=$monat&jahr=$jahr&anzeigen=$datum\" title=\"Einträge anzeigen\">$heute</a>");
$ty = true;
$tring .="$jahr.$monat.$tag-";
}
}
}
if (!$ty) {
$heute = ($tag == date("j") && $monat == date("n") && $jahr == date("Y")) ? "<span style=\"background-color: $zellenhintergrund_highlight;\">$tag</span>" : $tag;
array_push($zelle, $heute);
}
}
$zaehler = 1;
foreach ($zelle as $element) {
$spaltenende = ($zaehler % 7) ? "" : "</tr>\n<tr style=\"background-color: $zellenhintergrund_dunkel;\">";
echo "<td>" . $element . "</td>$spaltenende";
$zaehler++;
}
?>
</center>
Ich hoffe, dass mir jemand helfen kann :D
Vielen Dank
the_zoker_09
AW: Problem mit 2 PHP include() Datein
Also wenn du 2 Dateien includest musst du die natürlich anders Formatieren.
Am einfachsten wären eine Grundseite mit Frames.
Schwerer aber schöner wäre es die seite per Layer via CSS zu formatieren.
AW: Problem mit 2 PHP include() Datein
Und wie mach ich das am besten?
Hast du ein Tutorial für mich oder sowas?
Vielen Dank
the_zoker_09
AW: Problem mit 2 PHP include() Datein
Bei CSS bildest du so eine Art Gruppen, welche mittels CSS formatiert werden. Gleiche Gruppe bedeutet gleiche Formatierung. Du kannst aber auch in den HTML-Tags IDs vergeben, welche durch CSS aufgerufennund formatiert werden.
Ein Beispiel findest du in deinem ersten Quellcode, hier ein Auszug:
HTML-Code:
body {
font: 100%/1.4 Verdana, Arial, Helvetica, sans-serif;
background: #42413C;
margin: 0;
padding: 0;
color: #000;
}
Hier wird eben dem gesamten Body des HTML die gleiche Schriftart und Hintergrundfarbe zugeordnet.
Hier mal ein Tutorial. Ich hoffe es hilft weiter.
http://webmasterparadies.de/tutorial...l.html?start=2