0

I am trying to add pagination to the site. I am using structure (which I suspect is part of the problem). Here is my code:

 {exp:channel:entries channel="blog" cache="no" dynamic="no" orderby="published_date" limit="5" paginate="bottom" paginate_base="blog/index"}

 {!-- Other code here to display the entries. --}

 {paginate}
   {pagination_links}
     <ul class="inline">
       {previous_page}
         <li class="pull-left"><a href="{pagination_url}" class="page-previous bttn bttn-orange bttn-small"> &#8249; Previous</a></li>
       {/previous_page}

       {next_page}
         <li class="pull-right"><a href="{pagination_url}" class="page-next bttn bttn-orange bttn-small">Next Page &#8250;</a></li>
       {/next_page}
     </ul>
   {/pagination_links}
 {/paginate}
 {/exp:channel:entries}

The main problem is that something is overriding the paginate_base parameter and the value I am putting in there is getting ignored. The resulting links look like this:
http://www.faketld.com/blog/P5
http://www.faketld.com/blog/P10
etc.

I am expecting this to render links that look like this:
http://www.faketld.com/blog/index/P5
http://www.faketld.com/blog/index/P10
etc.

The strange thing is that if I use any other value for paginate_base it works as expected. For example:

paginate_base="index/blog" renders http://www.faketld.com/index/blog/P5
paginate_base="/" renders http://www.faketld.com/P5
paginate_base="peas/carrots" renders http://www.faketld.com/peas/carrots/P5

Oddly enough, it is specifically the one value I need to use that is overridden. Again, I have a feeling that Structure is causing this issue, but searching Google and this site haven't given me any solutions.

I have tried removing dynamic="no" but this seems to conflict with structure and I get no results.

Any help will be appreciated. Thank you.

0

The index template of any template group does not typically show up when accessed this way in the url. So when the pagination base parameter is used with a template group's index template, it will automatically remove it the index part of the url.

I guess it would also be helpful to know why you need the word index in the actual url (for pagination or any other reason) so another solution could be offered. There is probably another way to program your template to allow for pagination without the use of index. If there is not, I'm sorry but that is how expressionengine functions.

4
  • Thank you for your reply. The reason I need to have index in the url is because the pagination isn't working without it. It shows the same entries on every page. – Sarcastron Jun 3 '14 at 15:55
  • What if you take out the pagination base parameter? – Johnathan Waters Jun 3 '14 at 18:07
  • If I remove the pagination_base parameter, the result is the same (em. faketld.com/blog/P10) – Sarcastron Jun 9 '14 at 21:42
  • Do you have the blog channel set to "listing" in the structure settings? If you don't, set it to it and take out the dynamic parameter – Johnathan Waters Jun 10 '14 at 12:56
0

You should be able to take out the dynamic="no" parameter and it should fix the pagination problem. The dynamic parameter should only be included when there is the posibillity of a URL_title being in the URL.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.