开发者

script printing out first part of array twice

I have a script that i wrote, but it prints the first part of the array twice.

The output that i get is the following:

2009_06_09_02_07_57_Phase2_04.jpg 2009_06_09_02_07_33_Phase2_03.jpg 2009_06_09_02_07_57_Phase2_04.jpg

The code is below开发者_开发技巧:

            $currentPath = $path.'images/galleries/phase2/folder1/';

            $dirNew = opendir($currentPath);

                while ($file = readdir($dirNew)) {
                    if($file != "." && $file != ".." && $file != "Thumbs.db" && $file != "index.html" && $file != "index.php") {    
                            $dirArray[] = $file;

                            $indexCount = count($dirArray);

                            sort($dirArray);
                            for($i=0; $i < $indexCount; $i++) {
                                print $dirArray[$i].'<br />';

                        /*echo '<br /><a href="'.$currentPath.$dirArray[$i].'" title="image 1" class="thickbox" rel="phase 2">
<img src="'.$currentPath.$dirArray[$i].'" width="75" height="75" border="0"></a><br /><br />
Click image <br />for slideshow';*/

                            }

                    }
                }
                closedir($dirNew);


        }   

Any pointers in the right direction will be welcome.

Thanks in Advance


$indexCount = count($dirArray);

sort($dirArray);
for($i=0; $i < $indexCount; $i++) {
       print $dirArray[$i].'<br />';

Move it after the while {}

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜