CSS funktioniert in den TPLs nicht

daniel_sun

Erfahrenes Mitglied
Hallo,

ich weis nicht ob mein Problem im PHP oder im CSS liegt. Ich hatte eine Homepage erstellt und mein CSS funktionierte darin perfekt.

Nun arbeite ich mit der Template Engine nach diesem Tutorial:

http://php-coding-standard.de/php_template_engine.php

PHP-Technisch klappt das auch. Es wird alles so angezeigt wie ich es gern hätte nur seit der Umstellung "zickt" das CSS. Abstände werden z.B super dargestellt. Aber die schrift größe versagt völlig. jemand ne Idee?

Die Style.CSS

PHP:
body {
	background-color: #C0C0C0;
	font-size: 9pt;
	font-family: Verdana;	
}
img {
    border: none;
}
a {
	text-align: center;
	color: #000000;
}

a:link { text-decoration:underline; font-weight: normal; color:#000000; }
a:visited { text-decoration:underline; font-weight:normal; color:#000000; }
a:hover { text-decoration:underline; font-weight: bold;}
a:active { text-decoration:underline; font-weight:bold;  }
a:focus { text-decoration:underline; font-weight:normal;  }

.willkommen {margin-left: 30px; font-weight: bold; text-align: left;}
.rand {margin-left: 20px;}
.navi {margin-left: 5px; }
.navitexttitel {text-align: center; margin-top: 10px;  font-weight: bold;}
.navitext {margin-left: 28px;}
.newstexttitel {margin-left: 29px; margin-bottom: 3px; font-weight: bold; text-align: left;}
.newstext {margin-left: 30px; text-align: left;}
.newstextbottom {margin-left: 29px; font-size: 7.5pt; font-style: italic; text-align: left;}
.footer {vertical-align: middle;}
.righttitel {margin-left: 27px; margin-bottom: 3px; font-weight: bold; text-align: center;}
.righttext {margin-left: 27px; margin-top: 3px; text-align: center;}

Hier mein Template (tpl_news.tpl)
HTML:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
	<meta name="Daniel Klinger" content="">

	<title><?=$titel?></title>
</head>
<link rel="stylesheet" type="text/css" href="style.css">
<body>
<table border="0" cellpadding="0" cellspacing="0" align="center">
	<tr>
		<td background="gfx/header.png" width="1000" height="129">&nbsp;</td>
	</tr>
	<tr>
		<td background="gfx/welcome.png" width="1000" height="40"><div class="willkommen"><?=$welcome?></div></td>
	</tr>
	<tr>
		<td background="gfx/bg.png" width="1000">
<br>
		<table border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td valign="top" width="160">
					<!--Tabelle Navigation--!>
					<div class="navi">
					<table border="0" cellpadding="0" cellspacing="0">
						<tr>
							<td background="gfx/nav_top.png" width="160" height="55"><div class="navitexttitel">Aktuell</div></td>
						</tr>
						<tr>
							<td background="gfx/nav.png" width="160">
								<div class="navitext">
								<a href="index.php">Home</a><br>
								<a href="vorstand.php?id=2">Vorstand</a><br>
								<a href="kontakt.php">Kontakt</a><br>
								<a href="impressum.php?id=1">Impressum</a>
								</div>
							</td>
						</tr>
						<tr>
							<td background="gfx/nav_bottom.png" width="160" height="41">&nbsp;</td>
						</tr>
					</table>
					<table border="0" cellpadding="0" cellspacing="0">
						<tr>
							<td background="gfx/nav_top.png" width="160" height="55"><div class="navitexttitel">Herren</div></td>
						</tr>
						<tr>
							<td background="gfx/nav.png" width="160">
								<div class="navitext">	
								<a href="mannschaften.php?id=10">Herren I</a><br>
								<a href="mannschaften.php?id=11">Herren II</a><br>
								</div>
							</td>																
						</tr>
						<tr>
							<td background="gfx/nav_bottom.png" width="160" height="41">&nbsp;</td>
						</tr>
					</table>
					<table border="0" cellpadding="0" cellspacing="0">
						<tr>
							<td background="gfx/nav_top.png" width="160" height="55"><div class="navitexttitel">A-Jugend</div></td>
						</tr>
						<tr>
							<td background="gfx/nav.png" width="160">
								<div class="navitext">	
								<b>männl.:</b><br>
								<a href="mannschaften.php?id=1">A-Jugend</a><br>
								</div>
							</td>																
						</tr>
						<tr>
							<td background="gfx/nav_bottom.png" width="160" height="41">&nbsp;</td>
						</tr>
					</table>
					<table border="0" cellpadding="0" cellspacing="0">
						<tr>
							<td background="gfx/nav_top.png" width="160" height="55"><div class="navitexttitel">C-Jugend</div></td>
						</tr>
						<tr>
							<td background="gfx/nav.png" width="160">
								<div class="navitext">	
								<b>männl.:</b><br>
								<a href="mannschaften.php?id=2">C-Jugend I</a><br>
								<a href="mannschaften.php?id=3">C-Jugend II</a><br><br>
								<b>weibl.:</b><br>
								<a href="mannschaften.php?id=4">C-Jugend I</a><br>
								<a href="mannschaften.php?id=5">C-Jugend II</a><br>
								</div>
							</td>																
						</tr>
						<tr>
							<td background="gfx/nav_bottom.png" width="160" height="41">&nbsp;</td>
						</tr>
					</table>
					<table border="0" cellpadding="0" cellspacing="0">
					<tr>
					<td background="gfx/nav_top.png" width="160" height="55"><div class="navitexttitel">D-Jugend</div></td>
					</tr>
					<tr>
						<td background="gfx/nav.png" width="160">
						<div class="navitext">	
						<b>männl.:</b><br>
						<a href="mannschaften.php?id=6">D-Jugend</a><br>
						</div>
						</td>																
					</tr>
					<tr>
						<td background="gfx/nav_bottom.png" width="160" height="41">&nbsp;</td>
					</tr>
				</table>
				<table border="0" cellpadding="0" cellspacing="0">
					<tr>
						<td background="gfx/nav_top.png" width="160" height="55"><div class="navitexttitel">E-Jugend</div></td>
					</tr>
					<tr>
						<td background="gfx/nav.png" width="160">
							<div class="navitext">	
							<b>männl.:</b><br>
							<a href="mannschaften.php?id=7">E-Jugend</a><br><br>
							<b>weibl.:</b><br>
							<a href="mannschaften.php?id=8">E-Jugend</a><br>
							</div>
						</td>																
					</tr>
					<tr>
						<td background="gfx/nav_bottom.png" width="160" height="41">&nbsp;</td>
					</tr>
				</table>
				<table border="0" cellpadding="0" cellspacing="0">
					<tr>
						<td background="gfx/nav_top.png" width="160" height="55"><div class="navitexttitel">Minis</div></td>
					</tr>
					<tr>
						<td background="gfx/nav.png" width="160">
							<div class="navitext">	
							<b>gemischt:</b><br>
							<a href="mannschaften.php?id=9">Minis</a><br>
							</div>
						</td>																
					</tr>
					<tr>
						<td background="gfx/nav_bottom.png" width="160" height="41">&nbsp;</td>
					</tr>
				</table>
				<br>
				</div>
			</td>
			<td valign="top" width="635">
			<?php foreach ($table_data as $td_row): ?> 
				<table border="0" cellspacing="0" cellpadding="0">
					<tr>
						<td background="gfx/con_top.png" valign="bottom" width="640" height="31">
							<div class="newstexttitel"><?=$td_row['titel']?></div>
						</td>
					</tr>
					<tr>
						<td background="gfx/con_bg.png" valign="top" width="640">
							<div class="newstext">
							<table border="0" cellspacing="0" cellpadding="0">
								<tr>
									<td width="580"> 
										<?=$td_row['text']?>
									</td>
								</tr>
							</table>
							</div>
						</td>
					</tr>
					<tr>
						<td background="gfx/con_bottom.png" width="640" height="31">
							<div class="newstextbottom">Geschrieben von <b><?=$td_row['autor']?></b> am <b><?=$td_row['datum']?></b> um <b><?=$td_row['zeit']?></b>.</div>
						</td>
					</tr>
					</table>
				<?php endforeach; ?> 
				</td>
				<td width="198" valign="top">
					<table border="0" width="198" valign="top">
						<tr>
							<td>
								<table border = "0" cellspacing = "0" cellpadding="0" align="left" >
									<tr>
										<td background="gfx/right_start_2.png" width="198" height="32">&nbsp;&nbsp; <b>Statistiken:</b></td>
									</tr>
									<tr>
										<td background="gfx/right_middel_2.png" width="198">
											&nbsp;&nbsp;&nbsp;Besucher insgesamt:<br>
											&nbsp;&nbsp;&nbsp;<?=$ZAHL?><br><br>
											&nbsp;&nbsp;&nbsp;Besucher gerade online: <br>
											&nbsp;&nbsp;&nbsp;<?=$user_online?>
										</td>
									</tr>
									<tr>
										<td background="gfx/right_bottom_2.png" width="198" height="32" ></td>
									</tr>
								</table>
							</td>
						</tr>
						<tr>
							<td>
								<table border = "0" cellspacing = "0" cellpadding="0" align="left" >
									<tr>
										<td background="gfx/right_start_2.png" width="198" height="32">&nbsp;&nbsp; <b>Verein:</b></td>
									</tr>
									<tr>
										<td background="gfx/right_middel_2.png" width="198">
											<center>
											<a href="http://www.tvolpe.de" target="_blank">
												<img src="gfx/logo_tvolpe.gif" width="147" height="128" alt="logo_tvolpe">
											</a>
											</center>
										</td>
									</tr>
									<tr>
										<td background="gfx/right_bottom_2.png" width="198" height="32" ></td>
									</tr>
								</table>
							</td>
						</tr>
						<tr>
							<td>
								<table border = "0" cellspacing = "0" cellpadding="0" align="left" >
									<tr>
										<td background="gfx/right_start_2.png" width="198" height="32">&nbsp;&nbsp; <b>Sponsoren:</b></td>
									</tr>
									<tr>
										<td background="gfx/right_middel_2.png" width="198"><center></center></td>
									</tr>
									<tr>
										<td background="gfx/right_bottom_2.png" width="198" height="32" ></td>
									</tr>
								</table>
							</td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
		<!--ENDE Tabelle Navi und Concent trennen--!>
	</td>
</tr>
<tr>
	<td background="gfx/finish.png" width="1000" height="29"><div class="footer"><center><b><?=$copyright?></b></center></div></td>
</tr>
</table>
</body>
</html>

Zu kompletterung noch die PHP-Datei

PHP:
<?php
##   Modul: index.php
## Version: 1.00
##   Datum: 17.11.2008


include('inc/config.php'); 
##Modulinfo
$sql2 = 'UPDATE tvoh_modulinfo SET modulart = "PHP-Datei", modul = "/index.php", modulversion = "1.00", moduldatum = "17.11.2008" WHERE modulid = "1"';
mysql_query($sql2);

  ##NEWS-ABFRAGE
  $sql = "SELECT * FROM tvoh_news ORDER BY news_id DESC";
  $result = mysql_query($sql);
  $table_data = array();
  while ($row = mysql_fetch_assoc($result))
    { 
        array_push(
            $table_data,
            array(
                'titel' => $row['news_titel'],
                'text' 	=> $row['news_text'],
                'autor'	=> $row['news_autor'],
                'zeit' 	=> date("H:i", $row['news_datum']),
                'datum' => date("d.m.y", $row['news_datum'])
            )
        );
    }
  include('right_con.php');
  echo gettemplate("tpl_right_finish",$Content);

  
  require_once "tpl/tpl_news.tpl";
?>

Ich hoffe einer kann helfen. Ich rauf mir hier die Haare ^^.

Danke im Vorraus.

Gruß

daniel_sun
 
Zuletzt bearbeitet:
Moin,

die Vererbung deiner für body definierten Formate wird bei table unterbrochen.

Du könntest stattdessen den Universalselektor nutzen:
Code:
*{
    font-size: 19pt;
    font-family: Verdana;  
}

oder auch
Code:
body,th,td{
    font-size: 19pt;
    font-family: Verdana;  
}
...falls dir der Universalselektor als zu brutal erscheint :)

Ansonsten:
<link> gehört in den <head> und nicht zwischen </head> und <body>....was allerdings nichts mit dem Problem zu Tun hat.

Mit der Template-Engine hat das nichts zu Tun, entweder hast du vorher anderes CSS verwendet, oder aber keine Tabellen.
 

Neue Beiträge

Zurück