Sort() de output van een ereg
Ik krijg het niet voor elkaar, wie kan me (opweg) helpen
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
$xmlfile = fopen("news.xml", "r");
if(!$xmlfile)die("cannot open the xml file");
$readfile = fread($xmlfile ,400000);
$searchfile = eregi("<ActivateTime>(.*)</Text>", $readfile ,$arrayreg);
if ($arrayreg[0] == FALSE)
{
$count = 0;
}
else
{
$filechunks = explode("<Information>", $arrayreg[0]);
$count = sizeof($filechunks);
}
if ($count > 0)
{
for ($a = 0; $a < sizeof($filechunks); $a++)
{
ereg("<Text>(.*)</Text>",$filechunks[$a], $txt0);
}
}
echo "<table border='0'width='100%' bgcolor='#FFFFFF'>";
echo '<tr>';
echo "<td><b>Aantal meldingen: $count</b></td>";
echo '<td align="center"><h2>Verkeersinformatie</h2></td>';
echo "<td align='right'><font size='1'><img border='0' src='damnet.gif' alt='Verkeersinfo powered by DAMnet'><br/ >Overzicht gegenereerd: xxxxxx</font></td>";
echo '</tr>';
echo '</table>';
echo "<table border='0' cellspacing='0' width='100%' bgcolor='#FFFFFF'>";
for($i=0 ; $i<=$count-1 ;$i++)
{
ereg("<Class>0</Class><Text>(.*)</Text></Data><Data><Class>1</Class>",$filechunks[$i], $txt0);
ereg("<Class>1</Class><Text>(.*)</Text></Data><Data><Class>2</Class>",$filechunks[$i], $txt1);
ereg("<Class>2</Class><Text>(.*)</Text></Data><Data><Class>3</Class>",$filechunks[$i], $txt2);
ereg("<CreateTime>(.*)</CreateTime>",$filechunks[$i], $extrainfo);
echo "<tr>";
echo "<td valign='top'><font color='#FF0000'><b> ";
echo $txt0[1];
echo " </b></font></td><td><font size='2' color='#0099ff'>";
echo $txt1[1];
echo "<img border='0' align='absmiddle' src='icon_clip.gif'alt='Meldingstijd: $extrainfo[1] '></font></br ><font size='2' >";
echo $txt2[1];
echo "</font></br ></br ></td></tr>";
}
echo "</table>";
?>
$xmlfile = fopen("news.xml", "r");
if(!$xmlfile)die("cannot open the xml file");
$readfile = fread($xmlfile ,400000);
$searchfile = eregi("<ActivateTime>(.*)</Text>", $readfile ,$arrayreg);
if ($arrayreg[0] == FALSE)
{
$count = 0;
}
else
{
$filechunks = explode("<Information>", $arrayreg[0]);
$count = sizeof($filechunks);
}
if ($count > 0)
{
for ($a = 0; $a < sizeof($filechunks); $a++)
{
ereg("<Text>(.*)</Text>",$filechunks[$a], $txt0);
}
}
echo "<table border='0'width='100%' bgcolor='#FFFFFF'>";
echo '<tr>';
echo "<td><b>Aantal meldingen: $count</b></td>";
echo '<td align="center"><h2>Verkeersinformatie</h2></td>';
echo "<td align='right'><font size='1'><img border='0' src='damnet.gif' alt='Verkeersinfo powered by DAMnet'><br/ >Overzicht gegenereerd: xxxxxx</font></td>";
echo '</tr>';
echo '</table>';
echo "<table border='0' cellspacing='0' width='100%' bgcolor='#FFFFFF'>";
for($i=0 ; $i<=$count-1 ;$i++)
{
ereg("<Class>0</Class><Text>(.*)</Text></Data><Data><Class>1</Class>",$filechunks[$i], $txt0);
ereg("<Class>1</Class><Text>(.*)</Text></Data><Data><Class>2</Class>",$filechunks[$i], $txt1);
ereg("<Class>2</Class><Text>(.*)</Text></Data><Data><Class>3</Class>",$filechunks[$i], $txt2);
ereg("<CreateTime>(.*)</CreateTime>",$filechunks[$i], $extrainfo);
echo "<tr>";
echo "<td valign='top'><font color='#FF0000'><b> ";
echo $txt0[1];
echo " </b></font></td><td><font size='2' color='#0099ff'>";
echo $txt1[1];
echo "<img border='0' align='absmiddle' src='icon_clip.gif'alt='Meldingstijd: $extrainfo[1] '></font></br ><font size='2' >";
echo $txt2[1];
echo "</font></br ></br ></td></tr>";
}
echo "</table>";
?>
Hier staat het XML bestand wat ik inlees: http://damnet.nl/test/xml/news.xml
Er zijn nog geen reacties op dit bericht.