您好我有以下代码,它是从数据库中排序结果,我如何设置它以便结果将显示在2个不同的列中,一个用于template.channel_item.php,另一个用于template.channel_item.php其中2列将彼此相邻?
if(is_array($array)) {
foreach($array as $row) {
include($basepath.'/templates/template.channel_item.php');
include($basepath.'/templates/template.channel_item_title.php');
}
答案 0 :(得分: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;}
答案 1 :(得分: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; }