2013-03-26 1 views
0

안녕하세요 저는 데이터베이스에서 결과를 정렬하는 다음 코드를 사용하여 결과를 두 개의 다른 열, 한개는 template.channel_item.php, 다른 하나는 한 세트로 표시하도록 설정할 수 있습니다. 두 열이 서로 옆에있는 template.channel_item.php?갤러리의 형식 데이터베이스 목록

if(is_array($array)) { 
foreach($array as $row) { 
    include($basepath.'/templates/template.channel_item.php'); 
    include($basepath.'/templates/template.channel_item_title.php'); 
} 

답변

0
if(is_array($array)) { 
foreach($array as $row) { 

    echo '<div id="left">'; 
    include($basepath.'/templates/template.channel_item.php'); 
    echo '</div>'; 

    echo '<div id="right">'; 
    include($basepath.'/templates/template.channel_item_title.php'); 
    echo '</div>'; 
} 

CSS

#right { float:left; width: 400px;} 
#left { float:left; width: 400px;} 
+0

고마워! 탁월한 작품 – user981220

0

루프를 사용할 필요가 없습니다

<div class="item-section" style="clear:both"> 
<div id="left-sidebar"> 
<?php include($basepath.'/templates/template.channel_item.php'); ?> 
</div> 

<div id="right-sidebar"> 
<?php include($basepath.'/templates/template.channel_item_title.php'); ?> 
</div> 
</div> 

CSS

#left-sidebar, #right-sidebar { float: left; width: 400px; }