0

I am currently building a site with Expression Engine.

I have just put some pagination on my news pages. This works perfectly. However the pagination appears on the entry pages and I do not want it to.

I tried

{if segment_3 == ""} {paginate} Page {current_page} of {total_pages} {pagination_links}

{/paginate} {/if}

which removed it from the entry page... however this also removed it from all of the list pages... as P1/P2 etc will appear as segment_3..

any ideas?

Cheers Dave

magicspon
  • 926
  • 2
  • 9
  • 28

2 Answers2

1

Grab the Switchee plugin, then do this:

{exp:switchee variable="{segment_3}" parse="inward"}
{case value="#^P(\\d+)$#|''"}
    {paginate} Page {current_page} of {total_pages} {pagination_links}{/paginate}
{/case}
{/exp:switchee}

Although generally I'd suggest using separate templates for your entry list and single entry views. It's more keeping with how EE was designed, and will cause fewer problems down the road for you if you want to add things like category filtering, or filtering via third-party data (like tags, etc). You can use snippets to avoid duplicating Channel Entries "loop" code.

Derek Hogue
  • 4,589
  • 1
  • 15
  • 27
  • Excellent. Thank you very much. I've created separate templates for the entry list and entry view pages. I would Vote Up your answer but I do not have enough reputation points (first time on here!) – magicspon Apr 12 '12 at 15:28
  • 1
    Glad to help. You need to "accept" the answer - that will give you some points! – Derek Hogue Apr 12 '12 at 17:35
0

You can now do this out of the box:

paginate="hidden"

https://ellislab.com/expressionengine/user-guide/templates/pagination.html#id11

Alternatively you could make it paginate="inline" and wrap your logic around it with a count == 1 or count == total_results to have more control over where it is getting placed.

jnowland
  • 2,064
  • 19
  • 15