dorpbn1027 2013-04-16 17:48
浏览 19
已采纳

Foreach查询3列CSS

Hello I'd like to ask for help in regards to displaying the following query in 3 columns. I think I need to read up on arrays, because I can't seem to get anything working.. Is it doable with this code of mine, or would I need to rewrite this before getting my desired result?

<?php foreach ($this->items as $item) :?>
<?php if($item->state == 1 || ($item->state == 0 && JFactory::getUser()->authorise('core.edit.own',' com_bryllup'))):$show = true;?>
<input type="checkbox" name="<?php echo $item->felt_titel; ?>" value="<?php echo $item->felt_titel; ?>">
<h3><?php echo $item->felt_titel; ?></h3>
<p><?php echo $iyem->felt_beskrivelse; ?></p>
<?php endif; ?>

What I would like to achieve is something like this:

-Result1------Result2------Result3-
-Result4------Result5------Result6-
-etc-----------etc-----------etc---
  • 写回答

1条回答 默认 最新

  • doxp30826 2013-04-16 18:04
    关注

    Well since you've added a diagram of what you like then it's even easier. You can do it with your existing loop

    CSS

    // set width to a third of the width of the containing div
    div.result {
        width:250px;
        height:300px;
        float:left;
    }
    

    HTML

    <?php foreach ($this->items as $item) :?>
    <?php if($item->state == 1 || ($item->state == 0 && JFactory::getUser()->authorise('core.edit.own',' com_bryllup'))):$show = true;?>
    <input type="checkbox" name="<?php echo $item->felt_titel; ?>" value="<?php echo $item->felt_titel; ?>">
    
    <div class="result">
        <h3><?php echo $item->felt_titel; ?></h3>
        <p><?php echo $iyem->felt_beskrivelse; ?></p>
    </div>
    
    <?php endif; ?>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?