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.

Reversing order of sticky entries

January 11, 2012 7:06am

Subscribe [0]
  • #1 / Jan 11, 2012 7:06am

    welshartnow

    81 posts

    I’m not sure if I’m doing this in the best way.  What I want is my sticky entries to show ascending so that each time I add a new sticky entry it flows to the end of the sticky entries block.  Non sticky entries below this should flow in normal order, new entries showing at the top of non sticky entries.  The only way I could think of doing this was to include a double channel entry block as shown below.  I notice that the pagination contained in the second channel block controls the entry number for both blocks. Is this as expected or is there a better way to achieve my end.  Thanks for advice on this front.

    {exp:channel:entries channel="listings"  sort="asc"}
        {if sticky=="y"}
          show sticky entries asc
           {/if} 
    {/exp:channel:entries}
          
    {exp:channel:entries channel="listings" paginate="bottom" limit="7" sort="desc"}
        {if sticky !="y"}
          show non sticky entries in desc
           {/if} 
          {paginate}
          {pagination_links}
          {/paginate} 
    {/exp:channel:entries}
  • #2 / Jan 12, 2012 3:17pm

    Dan Decker

    7338 posts

    Hi welshartnow,

    You would need to add the dynamic=“no” parameter to the block that you want to be unaffected by pagination, like so:

    {exp:channel:entries channel="listings"  sort="asc" dynamic="no"}
        {if sticky=="y"}
          show sticky entries asc
           {/if} 
    {/exp:channel:entries}
          
    {exp:channel:entries channel="listings" paginate="bottom" limit="7" sort="desc"}
        {if sticky !="y"}
          show non sticky entries in desc
           {/if} 
          {paginate}
          {pagination_links}
          {/paginate} 
    {/exp:channel:entries}

    That will limit pagination to the second block and keep the first block “static”, so to speak.

  • #3 / Jan 13, 2012 6:10am

    welshartnow

    81 posts

    Thanks Dan,
    I actually want both blocks to be included within the overall pagination count.  I was just worried in case this might be unstable in some way. So including the pagination limit in the second block to control both channel blocks is fine?

  • #4 / Jan 17, 2012 9:14pm

    Dan Decker

    7338 posts

    Hi welshartnow,

    Yes, that is fine. That is how it is intended to function if the dynamic=“no” parameter is *not* used in other blocks. In that case, all channel entries tags on the template will be affected by the presence of the pagination directives in the URL. So, it sounds like you are getting just what you are looking for?

    Cheers!

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

ExpressionEngine News!

#eecms, #events, #releases