Don't loop code inside foreach bootstrap

Sam

I'm looping through an unknown number of containers which are using the col-md-8 Bootstrap class. I want to include next to the first iteration a col-md-4 class to offer up as a sidebar.

I need to pause the loop after the first iteration include my div then carry on looping from where it left off. Is there a php pause for the foreach loop so I can achieve this.

<?php  foreach ($news as $new) : ?>
<div class="col-md-8">

</div>
<?php endforeach; ?>
donald123

You can use a if-statement

<?php  
   $i=1;
   foreach ($news as $new) : ?>
        <div class="col-md-8">

         </div>
        <?php if($i==1):?>
          <div class="col-md-4">

         </div>
        <?php endif;?>
        <?php $i++;?>
<?php endforeach; ?>

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

Why can't I define a variable inside a for loop in this way?

来自分类Dev

Html/Js Input range object dynamically loaded inside a div don't works

来自分类Dev

'for' loop replaceable with 'foreach'

来自分类Dev

Querying other collection inside forEach

来自分类Dev

Find or forEach Inside 聚合 MongoDB

来自分类Dev

Bootstrap在foreach循环中崩溃

来自分类Dev

loading bootstrap inside php echo

来自分类Dev

Bootstrap tooltip not working inside table

来自分类Dev

Continue at first loop , inside the second loop

来自分类Dev

Using an IF statement inside loop vs outside the loop

来自分类Dev

Hibernate create, don't update, don't drop.

来自分类Dev

Best way for SqlConnection inside a loop

来自分类Dev

Is it possible to put XCTAsserts inside a loop?

来自分类Dev

Sequentially executing promises inside a for loop

来自分类Dev

find command behaviour inside for loop

来自分类Dev

Add static column inside foreach binding in knockout

来自分类Dev

PHP Foreach循环中的BOOTSTRAP表

来自分类Dev

forEach loop: Sum multiple values in the same Variable

来自分类Dev

getting array values without foreach loop

来自分类Dev

SQL query in Foreach loop using array variable

来自分类Dev

foreach loop item removal from an enumerated collection

来自分类Dev

DELETE FROM - foreach loop on MYSQL database

来自分类Dev

API搜索导致Foreach Loop变慢

来自分类Dev

Foreach循环获取IEnumerable <T>

来自分类Dev

underscore: async each loop waiting "inside"

来自分类Dev

Jpa persist/merge throws ConcurrentModificationException inside loop

来自分类Dev

从MySQL Cell Inside Loop PHP创建变量

来自分类Dev

Replace function of JavaScript don't work

来自分类Dev

Why PhpStorm don't recognizes $.post method?

Related 相关文章

热门标签

归档