你好,我有以下代码,这是从数据库排序结果,我如何设置它,所以结果将显示在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');
}
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;}
不需要使用loop
<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; }