Inside07 Posted December 1, 2004 Report Posted December 1, 2004 <? $dir = opendir("cars/$nameid/."); while (false !== ($file = readdir($dir))) { if ($file !== "cars/$nameid/." && $file !== "cars/$nameid/.." && $file !== "cars.php" && $file !== "cars.php~" ){ $imagesArray[] = $file; } } $count = count($imagesArray); if ($count > 0) { $count = count($imagesArray) - 1; // bildes atteeloshana print "<tr><td colspan=2>"; print "<img src=\"cars/".$nameid."/".$imagesArray[$_GET["img"]]."\" border=0>"; print "</td></tr>"; // Linku gjenereeshana $i = 2; print "<tr><td colspan=2 align=center>"; while ( $i <= $count ) { if ( $i == $_GET["img"] ) { $imgBOLD1 = "<b>"; $imgBOLD2 = "</b>"; } else { $imgBOLD1 = ""; $imgBOLD2 = ""; } $cnt = $i + 1; print "[<a href=\"?ID=".$car_id."&img=".$i."\">".$imgBOLD1.$cnt.$imgBOLD2."</a>] \n"; $i++; } ?> Kapeec jams izmet saakumaa 2 liekus linkus tb folderii ir 5 bildes , bet jamz uzgjeneree 7 linkus ? Jav ieprieksh danke
bubu Posted December 1, 2004 Report Posted December 1, 2004 (edited) Tāpēc ka tev šī rindiņa ir nepareiza: if ($file !== "cars/$nameid/." && $file !== "cars/$nameid/.." && $file !== "cars.php" && $file !== "cars.php~" ) Ja jau tu tajā direktorijā salīdzini vai $file nav vienāds ar cars.php faila nosaukumu, tad kāpēc . un .. priekšā liec cars/$nameid/, bet cars.php un .php~ nē?? Pareizāk būtu: if (!in_array($file,array('.', '..', 'cars.php', 'cars.php~'))) { ... Tak varēji jau arī paskatīties pats, kas ir ielicies $imagesArray masīvā, un visu redzētu ;) Edited December 1, 2004 by bubu
Inside07 Posted December 1, 2004 Author Report Posted December 1, 2004 oi milziigs paldies esmu diezgan jauns ieksh php tapeec veel riktiigi nezinu kas un kaa darbojs :)
Recommended Posts