PHP循环有助于添加非循环数据

我有一个PHP循环我的畅销书,但我需要在某种模式中添加一些销售点,我不知道如何做到这一点, 我需要做以下事情:
Product
Product
POS
POS
Product
Product
我怎样才能做到这一点?目前这是我的PHP循环,
<?php foreach ($featured as $product) : ?>
    <?php if(isset($product->productId)) : ?>
        <li>
        <h3><strong>Best Seller</strong> <a href="#" title="View Dining"><?php echo $product->rangeTitle; ?></a></h3>
        <a class="catJump" title="View Dining" href="#">View Dining</a>
        <a class="pImageLink" title="Buy the Bistro Chair" href="#"><img width="242" height="130" title="6 Seater Cube Set" alt="6 Seater Cube Set" src="/assets/img/temp/bestseller.jpg" /></a>
        <span class="bestSale">
            <h4>6 Seater Cube Set<br /><em>was <strike>&pound;3995</strike> NOW &pound;2995</em></h4>
            <a class="quickview" href="#" title="View Details"><strong>SAVE 10%</strong> Click here</a>
        </span>
        </li>
    <?php endif; ?>
<?php endforeach; ?>
    
已邀请:
<?php 
    $i = 0;
    $j = 0;
    $product_count = count($featured);
    while ($j<$product_count) {
        if ($i==2 || $i==3) {
            echo "POS";
        } else {
            echo $featured[$j]->productId;
            ++$j;
        }

        ++$i;
        if ($i>3) $i = 0;
    }
?>
我让你用你想要的替换
echo
语句     

要回复问题请先登录注册