Hi,
> note the "2" in that message. You are prob. resetting the readdir()
parameter in the script somewhere
No, as far as I can see, I'm not resetting the readdir().. but..
> You loop twice throu the same dir?
Yes I do.
Here is whole script:
<?php
if ($handle = opendir('news')) {
$sortArray=array();
while (false !== ($topic = readdir($handle))) {
if ($topic != "." && $topic != "..") {
while (false !== ($topic = readdir($handle)))
{
if($topic != "." && $topic != "..")
{
$topic=str_replace(".","",$topic);
array_push($sortArray,$topic);
}
}
sort($sortArray);
reset($sortArray);
$topicArray=array();
foreach($sortArray as $folder)
{
$year=substr($folder,4,0);
$month=substr($folder,2,4);
$day=substr($folder,2,6);
array_push($topicArray,$year.".".$month.".".$day);
}
foreach($topicArray as $topic)
{
// this part reads text from the text file
$path = "news/".$topic."/intro.txt";
$file = file($path);
foreach($file as $value ) {
$value = preg_replace("/\n/", "<br>", $value);
$intro_text .= "$value";
}
$intro_picture = $topic."/start.jpg";
$date = $topic;
echo "
<tr>
<td width='476' valign='top'><table width='100%' border='0'
cellpadding='0' cellspacing='0' class='raksti_bot'>
<!--DWLayoutTable-->
<tr>
<td width='100' height='100' align='center' valign='middle'
class='raksti_both_ver'>
<img src='news/".$intro_picture."' width='90' height='90'></td>
<td width='10'> </td>
<td width='281' valign='top'><br>".$intro_text."<br></td>
<td width='10'> </td>
<td width='75' align='center' valign='middle'
class='raksti_both_ver'>".$date."</td>
</tr>
</table></td>
</tr>
\n";
unset($intro_text);
}
}
closedir($handle);
}
}
?>
Lab.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php