Giúp Recent New hiển thị hơn 20 bài

Thảo luận trong 'Style & Template Questions' bắt đầu bởi bumbum12, 19/10/13.

1votes
5/5, 1 vote

  1. bumbum12

    bumbum12 Member

    Bài viết:
    305
    Likes :
    91
    Recent new bị giới hạn 20 bài. Có cách nào làm cho số lượng bài viết hiển thị nhiều hơn không anh em ?

    Và khi kéo xuống bottom, thì sẽ load thêm bài . Những bài hướng dẫn trước mình làm chưa ra cái này. Anh em giúp luôn nhé
     
    Đang tải...
  2. vương võ quốc

    vương võ quốc Member

    Bài viết:
    176
    Likes :
    34
    mo file Recent new.xml của bạn sửa lại dòng màu đỏ thêm bớt tùy thích
    <option option_id="RecentNews1_limit" edit_format="spinbox" data_type="unsigned_integer" display_order="2">
    <option_value>20</option_value>
    <edit_format_params>min=1
    max=20</edit_format_params>
    <sub_options></sub_options>
    <title>News Posts Per Page</title>
    <explain><![CDATA[The maximum number of articles to display on each page of the portal.]]></explain>
    </option>
     
    bumbum12 thích bài này.
  3. BeeSpeed

    BeeSpeed Member

    Bài viết:
    190
    Likes :
    87
    Bạn đem template này về ngâm cứu, bóc tách và áp dụng. cái này hồi lượm bên ksv về. áp dụng rất thành công :">

    Mã:
    <xen:require css="message_user_info.css" />
    <xen:require css="bb_code.css" />
    <xen:require css="EWRblock_RecentNewHOT.css" />
    
    <div id="RecentNews">
    <xen:foreach loop="$RecentNews" value="$news">
            <div class="RecentNewHOT " id="{$news.thread_id}">
    
                <div class="ABC_NCV primaryContent {xen:if {$option.leftdate}, 'leftDate'}">
                   
                            <div class="Head_NCV">
                        <div style="float:left; white-space: nowrap;margin-right:5px;">
                            <xen:avatar user="$news" size="s" itemprop="photo" />
                        </div>
                              <div class="h2_Title">
                        <h2><a href="{xen:link threads, $news}" title="{$news.title}" class="newsTitle">{xen:helper wordtrim, $news.title,25}</a></h2>
                                    {xen:phrase by_x_at_y,
                                'user=<a href="{xen:link members, $news}" class="username">{$news.username}</a>',
                                'date=<a href="{xen:link threads, $news}">{xen:time $news.post_date, 'absolute'}</a>'}
                              </div>
                    <div class="clearFix"></div></div>
    
                    <div class="NCV_MESS messageContent baseHtml">
                       
    
                        <div class="">{xen:helper stripHtml,{xen:raw $news.messageHtml}}</div>
                        <div class="clearFix"></div>
                    </div>
    
                    <xen:if is="{$news.promote_icon} != 'disabled'">
                    <xen:if hascontent="true">
                       
                            <div class="Block_plus">
                                <xen:contentcheck>
                                <xen:if is="{$news.attach}">
                                    <a href="{xen:link threads, $news}"><img src="{$news.attach.thumbnailUrl}" alt="{$news.attach.filename}" /></a>
                                <xen:elseif is="{$news.medio}" />
                                    <div style="background: url('{xen:helper medio, $news.medio}') no-repeat;">
                                        <a href="{xen:link 'full:media/media/popout', $news.medio}" class="OverlayTrigger"><img src="styles/8wayrun/EWRmedio_play.png" width="160" height="90" /></a>
                                    </div>
                                <xen:elseif is="{$news.image}" />
                                    <a href="{xen:link threads, $news}"><img src="http://img.sworld.mobi/timthumb/timthumb.php?src={$news.image}&h=130&w=310&zc=0" alt="{$news.title}" title="{$news.title}"/></a>
                                <xen:else />
                                    <a href="{xen:link threads, $news}"><img src="http://img.sworld.mobi/timthumb/timthumb.php?src=http://cdn.sworld.mobi/styles/default/xenforo/no.jpg&h=130&w=310&zc=0" alt="{$news.title}" title="{$news.title}"/></a>
                                </xen:if>
                                </xen:contentcheck>
                            </div>
                       
                    </xen:if>
                    </xen:if><div class="clearFix"></div>
                                <div class="Share_Block">
                                <ul style="float:left;"><li><span class="ViewCount_NCV">{xen:number $news.view_count} views</span></li></ul><ul style="float:right;"><li>
                                <div><a class="chiase_mxh FB" target="_blank" title="Ðăng lên FaceBook" href="http://www.facebook.com/share.php?u=http://www.sworld.mobi/{xen:link threads, $news}"></a><a class="chiase_mxh TW" target="_blank" title="Đăng lên Twitter" href="http://twitthis.com/twit?url=http://www.sworld.mobi/{xen:link threads, $news}" rel="external nofollow"></a></div>
                    </li></ul><div class="clearFix"></div></div>
                   
                </div>
            </div>
    
        </xen:foreach>
    
    <div class="clearFix"></div>
            <xen:if hascontent="true">
    
        <div style="display:none" class="section sectionMainNewHOT">
            <xen:contentcheck>
            <xen:if is="{$option.pagenav} && {$option.count} > {$option.limit}">
                <xen:if is="{$category}">
                    <xen:pagenav link="articles" linkdata="{$category}" page="{$page}" perpage="{$option.limit}" total="{$option.count}" />
                <xen:else />
                    <xen:pagenav link="portal" page="{$page}" perpage="{$option.limit}" total="{$option.count}" />
                </xen:if>
            </xen:if>
            </xen:contentcheck>
        </div>
    
        </xen:if>
    
    </div>
    <div class="NGVY"></div>
    <div class="clearFix"></div>
    
    <!---Auto load more-->
    <script src="http://cdn.sworld.mobi/js/loadmore/jquery.masonry.min.js"></script>
    <script src="http://cdn.sworld.mobi/js/loadmore/jquery.infinitescroll.min.js"></script>
    <script>
        if((navigator.userAgent.match(/chrome/i)) || (navigator.userAgent.match(/firefox/i))) {
          $(function(){
       
            var $container = $('#RecentNews');
       
            $container.imagesLoaded(function(){
              $container.masonry({
                itemSelector: '.NGVY'
              });
            });
       
            $container.infinitescroll({
              navSelector  : '.PageNav',    // selector for the paged navigation
              nextSelector : '.PageNav a:last',  // selector for the NEXT link (to page 2)
              itemSelector : '.ABC_NCV',    // selector for all items you'll retrieve
              loading: {
                  finishedMsg: 'Hết mất rồi :p',
                  //img: 'http://www.jquery4u.com/demos/infinite-scrolling-demo2/ajax-loader.gif'
                }
              },
              // trigger Masonry as a callback
              function( newElements ) {
                // hide new items while they are loading
                var $newElems = $( newElements ).css({ opacity: 1 });
                // ensure that images load before adding to masonry layout
                $newElems.imagesLoaded(function(){
                  // show elems now they're ready
                  $newElems.animate({ opacity: 1 });
                  $container.masonry( 'appended', $newElems, true );
                });
              }
            );
       
          });
        }
    </script>
    <!--/Auto load more-->
    <!--/Auto load more-->
    Đây là đoạn js :

    var $container = $('#RecentNews');
    itemSelector: '.NGVY' .NGVY là cái class chèn vào cuối cùng để cho khi kéo tới đây thì nó sẽ load tiếp.
     
    bumbum12 thích bài này.
comments powered by Disqus

Chia sẻ trang này

Đang tải...