doucang9673 2015-04-24 10:29
浏览 50
已采纳

opencart制作类别表而不是轮播

I am just trying to remake manufacturers carousel so that it will show categories with their images. Part of it I have done. Now i jast want to show them in table 4 in a row. Here is the code that is file catalog/view/module/carousel.tpl/

<div id="carousel<?php echo $module; ?>" class="owl-carousel">
   <div class="category"> 
        <table>
    <?php if($categories) { ?>
    <?php $count = 0;?>
        <?php foreach ($categories as $category) { ?>
        <?php if($count % 4 == 1){?>
         <tr>
         <?php}?>
        <td>
        <a href="<?php echo $category['href']; ?>" <?php echo $category['name']; ?></a>
       <img src="<?php echo $category['image'] ?>" alt="<?php echo $category['name']; ?>" title="<?php echo $category['name']; ?>" class="img-thumbnail" />
      <p><?php echo $category['name']?> 
      </td>
       <?php if($count % 4 == 0){?>
       </tr>
        <?php}?> 
      <?php } ?>
      <?php } ?>
        </table>
      </div>
</div>
<script type="text/javascript"><!--
$('#carousel<?php echo $module; ?>').owlCarousel({
    items: 15,
    autoPlay: 1000000,
    navigation: false,
    navigationText: ['<i class="fa fa-chevron-left fa-5x"></i>', '<i class="fa fa-chevron-right fa-5x"></i>'],
    pagination: false


});
--></script>

As a result of it I am getting error unexpected end of file. What am I doing wrong? Are their better solutions? I am using opencart version 2.0.1.1

  • 写回答

1条回答 默认 最新

  • dongmi4734 2015-04-24 10:37
    关注

    You need to make some minor changes and this will work:

    <?php if($count % 4 == 0){?>
       </tr>
    <?php } ?> //here you need to change
    $count++;
    

    Give the space after <?php tag. due to this the error occurs. There is require a space after this tag.

    And you are increasing the value of $count.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器