Crazy_down
Erfahrenes Mitglied
Hi, also ich habe eine HTML datei mit folgendem Inhalt.
Ich möchte aber nur diese Stelle hier haben.
Also dachte ich mir das ich mit einer if bedingung genau die stellen
'<table class=' & '</table>' ermittel und nur den teil dazwischen ausgeben lasse.
Aber irgendwie klappt das nicht so wie ich möchte.
So habe ich erstmal angefangen.
Es wird mir der Inhalt einfach nicht angezeigt. Mache ich die Ausgabe vor die If-Bedingung klappt die Ausgabe auch
Die Ausgabe das die Zeile gefunden wurde funktioniert auch.
greetz
crazy_down
HTML:
<html>
<head>
<title></title>
<meta http-equiv="expires" content="0">
<style type="text/css">
<!--
/* page title */
div.mon_title
{
font-weight: bold;
font-size: larger;
}
table.info
{
background-color: #F4F4F4;
border: 2px;
border-style:solid;
}
table.mon_list
{
background-color: #F4F4F4;
border: 2px;
border-style:solid;
}
td.info
{
}
th.list,
td.list
{
}
-->
</style>
<meta name="generator" content="gp-Untis 2007">
<meta name="company" content="Gruber & Petters Software, A-2000 Stockerau, Austria, www.grupet.at">
<meta http-equiv="refresh" content="5; URL=subst_001.htm">
</head>
<body bgcolor="#F0F0F0">
<CENTER>
<TABLE align="bottom" cellspacing="3" cellpadding="2">
<TR>
<TD align="bottom">
<font face="Verdana" size="6" color="#FF8000"><font size=-1>2007</font></font>
<br><font size="4" color="#000000" face="Arial">Info-Stundenplan</font>
</TD>
<TD> </TD>
<TD>
<TABLE width="100%" cellspacing="2" cellpadding="2">
<tr>
<TD>Stundenplan 2007/2008</TD>
<TD> </TD>
<TD> </TD>
<TD></TD>
</TR>
<TR>
<TD>Gilt ab: 10. Oktober</TD>
<TD> </TD>
<TD> </TD>
<TD>Stand: 22.06.2007 14:12</TD>
</TR>
</TABLE>
</TD>
</tr>
</TABLE>
<p>
<font size="3" face="Arial">
<div class='mon_title'>28.8.2006 Montag</div><p>
<table class='mon_list' rules="all" cellpadding="1" cellspacing="1">
<tr class='list'><th class='list' align=center>Vtr-Nr.</th><th class='list' align=center>Art</th><th class='list' align=center>Datum</th><th class='list' align=center>Stunde</th><th class='list' align=center>(Fach)</th><th class='list' align=center>Fach</th><th class='list' align=center>(Lehrer)</th><th class='list' align=center>Vertreter</th><th class='list' align=center>(Klasse(n))</th><th class='list' align=center>Klasse(n)</th><th class='list' align=center>(Raum)</th><th class='list' align=center>Raum</th><th class='list' align=center>Vertr. von</th><th class='list' align=center>(Le.) nach</th><th class='list' align=center>Text</th><th class='list' align=center>Vertretungs-Text</th><th class='list' align=center>Kopplung.</th><th class='list' align=center>Neu</th></tr>
<tr class='list'><td class='list' align=center>713</td><td class='list' align=center>Vertretung</td><td class='list' align=center>28.8. Mo</td><td class='list' align=center>1</td><td class='list' align=center>D</td><td class='list' align=center>D</td><td class='list' align=center>Hugo</td><td class='list' align=center>Nobel</td><td class='list' align=center>3b</td><td class='list' align=center>3b</td><td class='list' align=center>Ra</td><td class='list' align=center>Ra</td><td class='list'> </td><td class='list'> </td><td class='list'> </td><td class='list'> </td><td class='list'> </td><td class='list' align=center>x</td></tr>
<tr class='list'><td class='list' align=center>714</td><td class='list' align=center>Vertretung</td><td class='list' align=center>28.8. Mo</td><td class='list' align=center>2</td><td class='list' align=center>D</td><td class='list' align=center>D</td><td class='list' align=center>Hugo</td><td class='list' align=center>Curie</td><td class='list' align=center>3a</td><td class='list' align=center>3a</td><td class='list' align=center>R3a</td><td class='list' align=center>R3a</td><td class='list'> </td><td class='list'> </td><td class='list'> </td><td class='list'> </td><td class='list'> </td><td class='list' align=center>x</td></tr>
<tr class='list'><td class='list' align=center>25</td><td class='list' align=center>Pausenaufsicht</td><td class='list' align=center>28.8. Mo</td><td class='list' align=center>2/3</td><td class='list'> </td><td class='list'> </td><td class='list' align=center>Hugo</td><td class='list' align=center>Gauss</td><td class='list'> </td><td class='list'> </td><td class='list' align=center>Kell</td><td class='list' align=center>Kell</td><td class='list'> </td><td class='list'> </td><td class='list'> </td><td class='list'> </td><td class='list'> </td><td class='list' align=center>x</td></tr>
<tr class='list'><td class='list' align=center>715</td><td class='list' align=center>Vertretung</td><td class='list' align=center>28.8. Mo</td><td class='list' align=center>3</td><td class='list' align=center>D</td><td class='list' align=center>D</td><td class='list' align=center>Hugo</td><td class='list' align=center>Gauss</td><td class='list' align=center>4</td><td class='list' align=center>4</td><td class='list' align=center>R1a</td><td class='list' align=center>R1a</td><td class='list'> </td><td class='list'> </td><td class='list'> </td><td class='list'> </td><td class='list'> </td><td class='list' align=center>x</td></tr>
<tr class='list'><td class='list' align=center>4</td><td class='list' align=center>Vertretung</td><td class='list' align=center>28.8. Mo</td><td class='list' align=center>4</td><td class='list' align=center>D</td><td class='list' align=center>D</td><td class='list' align=center>Hugo</td><td class='list' align=center>Gauss</td><td class='list' align=center>4</td><td class='list' align=center>4</td><td class='list' align=center>R1a</td><td class='list' align=center>R1b</td><td class='list'> </td><td class='list'> </td><td class='list'> </td><td class='list'> </td><td class='list'> </td><td class='list' align=center>x</td></tr>
<tr class='list'><td class='list' align=center>716</td><td class='list' align=center>Entfall</td><td class='list' align=center>28.8. Mo</td><td class='list' align=center>5</td><td class='list' align=center>Gw</td><td class='list' align=center>---</td><td class='list' align=center>Hugo</td><td class='list' align=center>---</td><td class='list' align=center>3a</td><td class='list' align=center>3a</td><td class='list' align=center>R3a</td><td class='list' align=center>---</td><td class='list'> </td><td class='list' align=center>Entfall</td><td class='list' align=center> </td><td class='list' align=center> </td><td class='list' align=center> </td><td class='list' align=center> </td></tr>
</table>
<p>
<font size="3" face="Arial">
</font></font>
</CENTER>
<p>
</body>
</html>
HTML:
<table class='mon_list' rules="all" cellpadding="1" cellspacing="1">
<tr class='list'><th class='list' align=center>Vtr-Nr.</th><th class='list' align=center>Art</th><th class='list' align=center>Datum</th><th class='list' align=center>Stunde</th><th class='list' align=center>(Fach)</th><th class='list' align=center>Fach</th><th class='list' align=center>(Lehrer)</th><th class='list' align=center>Vertreter</th><th class='list' align=center>(Klasse(n))</th><th class='list' align=center>Klasse(n)</th><th class='list' align=center>(Raum)</th><th class='list' align=center>Raum</th><th class='list' align=center>Vertr. von</th><th class='list' align=center>(Le.) nach</th><th class='list' align=center>Text</th><th class='list' align=center>Vertretungs-Text</th><th class='list' align=center>Kopplung.</th><th class='list' align=center>Neu</th></tr>
<tr class='list'><td class='list' align=center>713</td><td class='list' align=center>Vertretung</td><td class='list' align=center>28.8. Mo</td><td class='list' align=center>1</td><td class='list' align=center>D</td><td class='list' align=center>D</td><td class='list' align=center>Hugo</td><td class='list' align=center>Nobel</td><td class='list' align=center>3b</td><td class='list' align=center>3b</td><td class='list' align=center>Ra</td><td class='list' align=center>Ra</td><td class='list'> </td><td class='list'> </td><td class='list'> </td><td class='list'> </td><td class='list'> </td><td class='list' align=center>x</td></tr>
<tr class='list'><td class='list' align=center>714</td><td class='list' align=center>Vertretung</td><td class='list' align=center>28.8. Mo</td><td class='list' align=center>2</td><td class='list' align=center>D</td><td class='list' align=center>D</td><td class='list' align=center>Hugo</td><td class='list' align=center>Curie</td><td class='list' align=center>3a</td><td class='list' align=center>3a</td><td class='list' align=center>R3a</td><td class='list' align=center>R3a</td><td class='list'> </td><td class='list'> </td><td class='list'> </td><td class='list'> </td><td class='list'> </td><td class='list' align=center>x</td></tr>
<tr class='list'><td class='list' align=center>25</td><td class='list' align=center>Pausenaufsicht</td><td class='list' align=center>28.8. Mo</td><td class='list' align=center>2/3</td><td class='list'> </td><td class='list'> </td><td class='list' align=center>Hugo</td><td class='list' align=center>Gauss</td><td class='list'> </td><td class='list'> </td><td class='list' align=center>Kell</td><td class='list' align=center>Kell</td><td class='list'> </td><td class='list'> </td><td class='list'> </td><td class='list'> </td><td class='list'> </td><td class='list' align=center>x</td></tr>
<tr class='list'><td class='list' align=center>715</td><td class='list' align=center>Vertretung</td><td class='list' align=center>28.8. Mo</td><td class='list' align=center>3</td><td class='list' align=center>D</td><td class='list' align=center>D</td><td class='list' align=center>Hugo</td><td class='list' align=center>Gauss</td><td class='list' align=center>4</td><td class='list' align=center>4</td><td class='list' align=center>R1a</td><td class='list' align=center>R1a</td><td class='list'> </td><td class='list'> </td><td class='list'> </td><td class='list'> </td><td class='list'> </td><td class='list' align=center>x</td></tr>
<tr class='list'><td class='list' align=center>4</td><td class='list' align=center>Vertretung</td><td class='list' align=center>28.8. Mo</td><td class='list' align=center>4</td><td class='list' align=center>D</td><td class='list' align=center>D</td><td class='list' align=center>Hugo</td><td class='list' align=center>Gauss</td><td class='list' align=center>4</td><td class='list' align=center>4</td><td class='list' align=center>R1a</td><td class='list' align=center>R1b</td><td class='list'> </td><td class='list'> </td><td class='list'> </td><td class='list'> </td><td class='list'> </td><td class='list' align=center>x</td></tr>
<tr class='list'><td class='list' align=center>716</td><td class='list' align=center>Entfall</td><td class='list' align=center>28.8. Mo</td><td class='list' align=center>5</td><td class='list' align=center>Gw</td><td class='list' align=center>---</td><td class='list' align=center>Hugo</td><td class='list' align=center>---</td><td class='list' align=center>3a</td><td class='list' align=center>3a</td><td class='list' align=center>R3a</td><td class='list' align=center>---</td><td class='list'> </td><td class='list' align=center>Entfall</td><td class='list' align=center> </td><td class='list' align=center> </td><td class='list' align=center> </td><td class='list' align=center> </td></tr>
</table>
Also dachte ich mir das ich mit einer if bedingung genau die stellen
'<table class=' & '</table>' ermittel und nur den teil dazwischen ausgeben lasse.
Aber irgendwie klappt das nicht so wie ich möchte.
So habe ich erstmal angefangen.
PHP:
<?php
//Datei Öffnen mit Fopen()
$datei = fopen('subst_001.htm','r');
$schreiben = fopen('subst_001.txt','w');
// Inhalt der Datei Zeilenweise Einlesen und im Browser ausgeben.
if($datei)
{
while (!feof($datei)) {
$zeile = fgets($datei);
fwrite($schreiben, $zeile);
if($zeile='<table class=')
{
echo "Zeile mit <table class= gefunden";
while($zeile!='</table>')
{
echo $zeile;
}
}
}
fclose($datei);
}
?>
Es wird mir der Inhalt einfach nicht angezeigt. Mache ich die Ausgabe vor die If-Bedingung klappt die Ausgabe auch
Die Ausgabe das die Zeile gefunden wurde funktioniert auch.
greetz
crazy_down