1

我实现了Yii 无限滚动

现在我想知道是否可以在 1 个视图中使用两次小部件,例如:

<div id="demo-area1">
    <div class="items">
        <div class="messages">
            <?php foreach($provider->getData() as $i => $item): ?>
                <div class="item">
                    <?php echo CHtml::image($item["ImageUrl"]); ?>
                    <p class="author"><?php echo $item["User"]; ?></p>
                    <p class="message"><?php echo $item["Message"]; ?></p>
                    <p class="publication_date"><?php echo Yii::app()->dateFormatter->formatDateTime($item["Time"]); ?></p>
                </div>
            <?php endforeach; ?>
        </div>
        <?php $this->widget("ext.yiinfinite-scroll.YiinfiniteScroller", array(
                            "itemSelector" => "div.items1", 
                            "pages" => $provider->pagination)); ?>
    </div>
</div>

 <div id="demo-area2">
     <div class="items">
         <div class="messages">
             <?php foreach($provider->getOtherData() as $i => $item): ?>
                 <div class="item">
                     <?php echo CHtml::image($item["ImageUrl"]); ?>
                     <p class="author"><?php echo $item["User"]; ?></p>
                     <p class="message"><?php echo $item["Message"]; ?></p>
                     <p class="publication_date"><?php echo Yii::app()->dateFormatter->formatDateTime($item["Time"]); ?></p>
                 </div>
             <?php endforeach; ?>
         </div>
         <?php $this->widget("ext.yiinfinite-scroll.YiinfiniteScroller", array(
                                "itemSelector" => "div.items2", 
                                "pages" => $provider->pagination)); ?>
        </div>
    </div>

当我使用它时,只有第一个无限滚动有效。我如何让第二个工作?

4

0 回答 0