如何在PHP中自定义猫头鹰轮播类

时间:2018-08-15 16:13:28

标签: php html5 owl-carousel

我要自定义此轮播。我想在php中动态制作。当它查看4个项目时,其类别为“项目有效”。并且这四个项目在页面首次加载时保持活动状态。对于其他项目,它的类别仅为“项目”。如何动态调用“活动”类。

这是

class =“ item active”

 <div class="item active">
   <?php 
        $sql = mysqli_query($con,"SELECT * FROM product WHERE featured = 'featured' ORDER BY id DESC LIMIT 4");
               while($row = mysqli_fetch_assoc($sql)){
    ?>
    <div class="single-wid-product sel-pd">
        <a href="#"><img src="admin/upload/<?php echo $row['file']; ?>" alt="" class="product-thumb"></a>
        <h2><a href="single-product.html"><?php echo $row['pro_title'] ?</a></h2>                                    
        <div class="product-wid-price">
           <ins>$<?php echo $row['pro_price']; ?></ins>
        </div>
     </div>
      <?php } ?>
 </div>

这是class =“ item”

<div class="item">
   <?php 
        $sql = mysqli_query($con,"SELECT * FROM product WHERE featured = 'featured' ORDER BY id DESC LIMIT 4");
               while($row = mysqli_fetch_assoc($sql)){
    ?>
    <div class="single-wid-product sel-pd">
        <a href="#"><img src="admin/upload/<?php echo $row['file']; ?>" alt="" class="product-thumb"></a>
        <h2><a href="single-product.html"><?php echo $row['pro_title'] ?</a></h2>                                    
        <div class="product-wid-price">
           <ins>$<?php echo $row['pro_price']; ?></ins>
        </div>
     </div>
      <?php } ?>
 </div>

0 个答案:

没有答案