Ludzie pomocy.Dlaczego ten kod działa:
$iColumns = 3;
array('img' => '1r.jpg', 'title' => 'Kurs smarty'), array('img' => '2.jpg', 'title' => 'Kurs php'), array('img' => '3.jpg', 'title' => 'Wstęp smarty'), array('img' => '4.jpg', 'title' => 'Zaawansowane smarty') );
if(count($aData) % $iColumns) { }
foreach($aData as $iKey => $aRow) {
if(!($iKey % $iColumns)) {
}
if($aRow) {
echo "<img src=".KATALOG_ZDJEC
.$aRow[img
].">"; }
if(!(($iKey-$iColumns+1) % $iColumns)) {
}
}
A ten juz nie pomimo tego,że funkcja file() powinna zapisać do tablicy zawartość pliku składającą się z nazw plików graficznych w kolejnych liniach:
$iColumns = 3;
define('KATALOG_ZDJEC','./img/'); $aData=file("lista_zdj.txt");
if(count($aData) % $iColumns) { }
foreach($aData as $iKey => $aRow) {
if(!($iKey % $iColumns)) {
}
if($aRow) {
echo "<img src=".KATALOG_ZDJEC
.$aRow[img
].">"; }
if(!(($iKey-$iColumns+1) % $iColumns)) {
}
}