ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Paginate not working properly

November 02, 2012 2:24am

Subscribe [3]
  • #1 / Nov 02, 2012 2:24am

    W3 | 84ideas

    22 posts

    Hi,
     
      I am using EE v2.5.3,on news overview page I have to show group of 4 news items each with pagination.It works fine when I fetch all news items but my requirement is to filter out news items based on publish date and archive date.I am using if condition after the channel entry expression like this

    {exp:channel:entries channel="nieuws" orderby="date" sort="desc" paginate="bottom" status="nl|{exp:transcribe:language_abbreviation}"  dynamic="no"  limit="4"}
         {if current_time >= news_publish_date AND news_archive_date > current_time}           
        <article>     
         <div class="container">
            {nieuws_images limit="1" sort="asc"}
            {exp:imgsizer:size src="{nieuws_image}" width="97" height="97"}
              <div class="img_container">
              {sized}
             </div> 
            {/exp:imgsizer:size}
            {/nieuws_images}      
              
          <div class="content_container">
            <h1>{title}</h1>        
                   {exp:trunchtml chars="400" exact="yes"}
                {nieuws_short_description}
            {/exp:trunchtml}
            {if status == "nl"}         
             <a href="http://{path=nieuws/artikel/{url_title}}class=full_block_click">Lees hier verder ></a>
            {if:elseif status == "en"}
             <a href="http://{path=news/article/{url_title}-}">Read More >></a>
             <a href="http://{path=news/article/{url_title}-}class=full_block_click"> </a>
              
            {/if}
                                   
          </div>
         </div>
        </article>    
        {/if}
         {paginate} 
          <div class="pagination">
           {pagination_links}
          </div> 
         {/paginate}
        {/exp:channel:entries}

     
      and due to if condition few news items are omitted,now pagination is showing 2 items on first page,4 items on second ,1 item on third page and so on.basically the whole pagination is messed up.

      I would appreciate if anyone can help me out

    Thanks

  • #2 / Nov 05, 2012 1:54pm

    Shane Eckert

    7174 posts

    Hey W3,

    Pagination is based on the amount of entries returned from the channel entries tag and the limit.

    So you are probably getting 4 results but then you filter down even further and only show what meets your filters.

    You will want to refine the results before you display them with the channel entries tag. Maybe think about how you can list using the start on parameter and setting that to the publish_date.

    What do you think?

    Cheers,

  • #3 / Nov 06, 2012 7:33am

    W3 | 84ideas

    22 posts

    Thanks Shane for replying,will check if it helps to solve the problem.

    Regards

    W3

  • #4 / Nov 07, 2012 10:55am

    Shane Eckert

    7174 posts

    Hey W3,

    Awesome.

    How are thing going?

    Cheers,

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases