首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在第4张相册PHP后添加新行

在第4张相册PHP后添加新行
EN

Stack Overflow用户
提问于 2014-02-22 01:08:30
回答 1查看 767关注 0票数 2

因此,我试图在每4次画廊之后添加一个新的行,并继续下去,直到我没有画廊可添加。因此,如果有17个画廊,将有4行4画廊和1行剩下的画廊。下面是它的外观示例:http://www.csulb.edu/centers/latinohealth/media/galleries/

这是我的代码:

代码语言:javascript
复制
<?php $this->start_element('nextgen_gallery.gallery_container', 'container', $displayed_gallery); ?>

<div class="row-fluid secondone">
<div class="ngg-albumoverview span12">
<div class="row-fluid"> 
<?php $count = 0;?>
<?php foreach ($galleries as $gallery) {
    $count++;
    ?>


    <div class="ngg-album span3">
        <div class="ngg-albumtitle">
            <a href="<?php echo nextgen_esc_url($gallery->pagelink); ?>"><?php echo_safe_html($gallery->title); ?></a>
        </div>
        <div class="ngg-albumcontent">
            <div class="ngg-thumbnail">
                <a class="gallery_link" href="<?php echo nextgen_esc_url($gallery->pagelink); ?>"><img class="Thumb" alt="<?php echo esc_attr($gallery->title); ?>" src="<?php echo nextgen_esc_url($gallery->previewurl); ?>"/></a>
            </div>
            <div class="ngg-description">
                <p><?php echo_safe_html($gallery->galdesc); ?></p>
                <?php if (isset($gallery->counter) && $gallery->counter > 0) { ?>
                    <p><strong><?php echo $gallery->counter; ?></strong>&nbsp;<?php _e('Photos', 'nggallery'); ?></p>
                <?php } ?>
            </div>
        </div>
    </div>
    <?php if ($count % 4 == 0 ) ?>
    </div>
    <div class="row-fluid">
<?php  } ?>
  </div>
</div>
</div>
<?php $this->end_element(); ?>
EN

回答 1

Stack Overflow用户

发布于 2014-02-22 01:25:56

您需要使用css样式来做您想做的事情,而不是使用php。创建一个固定宽度的容器块,该块可以包含精确的4个库,并在库的框上使用浮动属性。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/21948247

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档