다음 PHP 코드는 예상대로 작동하지만 "col-md-4"div가 서로 아래에 나타나지 않습니다. 3 행을 보여줍니다.PHP 코드에서 col-md-4 divs가 서로 나란히 있지 않고 아래에 표시됩니다.
아무도 내가 잘못한 것을 도와 줄 수 있습니까? 다음과 같이
<?php
$previousCat = null; // starts the category at NULL
while(!$DETAILS->atEnd()) {
// Check if GENUS if different. If yes then display GENUS and start row to contain all varieties
if($DETAILS->getColumnVal("GENUS") != $previousCat) {
echo '<div class="row">
<div class="col-md-6 g-my-10 g-bg-pale"><h2>'.$DETAILS->getColumnVal("GENUS").'</h2></div>
</div>
<div class="row">';
}
// now we output whatever is needed at the start of a new group - in this case,
// user name and date, since we want those only once
echo '
<div class="col-md-4" data-animate-inview="20" style="min-height: 345px; margin-top: 10px; margin-bottom: 15px">
<p><img src="17_photos/'.$DETAILS->getColumnVal("IMAGE").'" title="'.$DETAILS->getColumnVal("VARIETY").'" class="img-fluid" /></p>
<p><strong>'.$DETAILS->getColumnVal("VARIETY").'</strong>
<br />'.$DETAILS->getColumnVal("DESCRIPTION").'
<br />'.$DETAILS->getColumnVal("TYPE").'</p>
</div>
';
// if GENUS is different end the row that contains the varieties
if($DETAILS->getColumnVal("GENUS") != $previousCat) {
echo '</div>';
}
// save the GENUS for comparison with next GENUS
$previousCat = $DETAILS->getColumnVal("GENUS");
$DETAILS->moveNext();
}
$DETAILS->moveFirst(); //return RS to first record
?>
출력 코드는 - 별도의 사업부가 최초의 뒤에 배치되는 것 같습니다 COL-MD-4
<div class="row">
<div class="col-md-6 g-my-10 g-bg-pale"><h2>Asian Greens</h2></div>
</div>
<div class="row">
<div class="col-md-4" data-animate-inview="20" style="min-height: 345px; margin-top: 10px; margin-bottom: 15px">
<p><img src="17_photos/02897.07.Tatsoi.cat.jpg" title="Tatsoi" class="img-fluid" /></p>
<p><strong>Tatsoi</strong>
<br />dark spicy asian green
<br /></p>
</div>
</div><div class="row">
<div class="col-md-6 g-my-10 g-bg-pale"><h2>Beets</h2></div>
</div>
<div class="row">
<div class="col-md-4" data-animate-inview="20" style="min-height: 345px; margin-top: 10px; margin-bottom: 15px">
<p><img src="17_photos/nopic.jpg" title="Baby Beats" class="img-fluid" />
</p>
<p><strong>Baby Beats</strong>
<br />
<br /></p>
</div>
</div>
<div class="col-md-4" data-animate-inview="20" style="min-height: 345px; margin-top: 10px; margin-bottom: 15px">
<p><img src="17_photos/nopic.jpg" title="Blankoma" class="img-fluid" /></p>
<p><strong>Blankoma</strong>
<br />white, round
<br /></p>
</div>
귀하의 문제는 당신이 새 행을 만드는 것 같다
페이지 원본을 볼 때 출력 HTML 샘플을 게시해야합니다. 그 후에 이것은 PHP가 아닌 CSS/HTML 질문이됩니다. –
은 '컨테이너'또는 '컨테이너 - 유체'(가로형)입니까? – apokryfos
감사합니다. Michael. html 출력을 게시했습니다. GENUS가 변경되면 각 col-md-4의 첫 번째 인스턴스에 여분의 div를 배치하는 것처럼 보입니다. 나는 내가 잘못한 곳을 보지 못한다. –