magicspon
magicspon

Reputation: 926

How can I hide the pagination on entry pages in expression engine?

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

Upvotes: 0

Views: 254

Answers (2)

jnowland
jnowland

Reputation: 2215

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.

Upvotes: 0

Derek Hogue
Derek Hogue

Reputation: 4564

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.

Upvotes: 1

Related Questions