يقوم هذا الكود بقرائة محتويات مجلد وسوف تكون المحتويات هي صور ايقونات
ولكن المهم عندي ان اضع زرين هما السابق و التالي
ويتم عرض فقط عشرين صورة ايقونة
الكود الذي ساويته هو :
كود:<table width=75% border=1 align=center height=8 cellspacing=1 cellpadding=1 bgcolor=#CCCCCC bordercolor=#000000><tr> <? include("cards.php"); if ($cat != "") { $currentdir = $imagedir . "/" . $cat; } else { $currentdir = $imagedir; } $handle=opendir($currentdir); while (false!==($file = readdir($handle))) { if ($file != "." && $file != "..") { if (!is_dir($currentdir . "/" . $file)) { print "<td><a href=postcards.php?show=$currentdir/$file&cat=$cat><center><img width=75 height=75 src=$currentdir/$file></center></a></td>\n"; } } } ?> </tr></table>
بصراحة انا حاولت ان اضيف عداد ولكن لم انجح وكان الذي ساويته
هو التالي :
كود:<table width=75% border=1 align=center height=8 cellspacing=1 cellpadding=1 bgcolor=#CCCCCC bordercolor=#000000><tr> <? include("cards.php"); if ($cat != "") { $currentdir = $imagedir . "/" . $cat; } else { $currentdir = $imagedir; } $handle=opendir($currentdir); $counter = 0; while (false!==($file = readdir($handle))) { if ($file != "." && $file != ".." && is_file($currentdir."\\".$file)) { $counter++ if ( $counter > $posDirectory ) { print "<td> <a href=postcards.php?show=$currentdir/$file&cat=$cat><center><img width=75 height=75 src=$currentdir/$file></center></a></td>\n"; $dirCount++; if($dirCount == 20) break; } } } echo '<a href="dir.php?posDirectory=$posDirectory">next</a>'; echo '<a href="dir.php?posDirectory=$posDirectory-20">back</a>'; ?> </tr></table>
لكن دائما يعطيني غلط عند السطر 20 وهو سطر العداد
$counter++
فما العمل ؟





