2012-04-10 17 views
-6

私は問題があり解決しませんでした。そのようなphpで写真を予約

What i want is that listing photos side to side 

enter image description here

The problem is that when i have 50 photos , this happens 

enter image description here

私が欲しいの列ごとに10枚の写真を一覧表示することです。どうやってやるの ?

+0

あなたのcss/browser/htmlは何ですか –

+0

これは表示(スタイル)の問題かPHPですか? –

答えて

1

あなたがそうのように、すべての10枚の写真を分割する必要があり、画像を表示するためにループ:

$photosPerLine = 10; 
for (var $i = 0; $i < $totalNumPhotos; $i++) 
{ 
    drawPhoto(); // This does the actual drawing - perhaps echo a <IMG> or whatever 

    // Now we check if we've reached 10 in a row, we do this by dividing the 
    // photo counter by 10 and checking for a reminder, only numbers in leaps 
    // of 10 will divide without a reminder. If we don't have a reminder it means 
    // we're at 10, 20, 30 ... so we break the line 

    if (($i + 1) % $photosPerLine == 0) 
    { 
     echo('<br/>'); // Or create a new row in a table or whatever 
    } 
} 

それとも、正確に10枚の画像を保持するために指定された幅とコンテナ(例えば<div>)に画像を配置すると、ブラウザがコンテンツに合うように改行してください。