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.

Single post pagination with permalinks

April 13, 2012 9:01am

Subscribe [3]
  • #1 / Apr 13, 2012 9:01am

    Rommel

    14 posts

    A long title but that is what I need… because I’m in a situation I need this solutions.

    I have a simple pierce of code on my website, lets name it for this example: domain.com

    {exp:channel:entries limit="1" channel="news" disable="trackbacks|member_data|category_fields|categories" orderby="entry_id"}
     <div class="news">
      {newsimage}
      {paginate}
              {if previous_page}
        <a href="http://{auto_path}" title="Next" class="next">Next</a>
       {/if}
       {if next_page}
        <a href="http://{auto_path}" title="Previous" class="prev">Prev</a>
       {/if}
      {/paginate}
     </div>
    {/exp:channel:entries}

    Everything is working fine, but when I press the next/previous button the link is: domain.com/P1, domain.com/P2 etc. That is not handy because when a new item is placed all items have a other number.

    Is there a way that the next/previous link is the permalink for the item?

    I tried first the Next/Previous Entry Linking, but that is not working either…

  • #2 / Apr 13, 2012 12:07pm

    aelvan

    33 posts

    Next/Previous entry linking should work for this. Are you sure you put the tags outside of the {exp:channel:entries} tag?

  • #3 / Apr 13, 2012 1:05pm

    Rommel

    14 posts

    Next/Previous entry linking should work for this. Are you sure you put the tags outside of the {exp:channel:entries} tag?

    Next/Previous entry linking is only available when the url is something like domain.com/news/3, that’s how the ‘system’ knows where it is. At least… that’s how I learned it. 😊

  • #4 / Apr 13, 2012 1:21pm

    aelvan

    33 posts

    Ahh, right. I failed to see the url structure you wanted. Actually, I solved something similar to this with the Advanced Prev Next Entry addon (http://devot-ee.com/add-ons/advanced-prev-next-entry) some time ago. Maybe something like the free Next Previous Links Anywhere (http://devot-ee.com/add-ons/next-previous-links-anywhere) could work too. I guess there’s no native solution for this, EE loves it’s dynamic urls… 😉

  • #5 / Apr 13, 2012 1:27pm

    Rommel

    14 posts

    They love them indeed! Thanks for the plugin links!

    But! I did it a little bit different. I made a new group with the name redirect and made it the home page for my site with this code:

    {exp:channel:entries limit="1" channel="news" disable="trackbacks|pagination|member_data|custom_fields|category_fields|categories" orderby="entry_id"}
     {redirect='news/{url_title}'}
    {/exp:channel:entries}

    As you can see, it only redirects to the last entry. And then the Next/Previous code are just working fine. It is working, maybe not the best solutions but I’m happy. :p And it doesn’t slow down that much.

  • #6 / Apr 16, 2012 10:55am

    Dan Decker

    7338 posts

    Hi Rommel,

    I’m glad to see you have found a solution that suits your needs! I would like to point out that the current release of ExpressionEngine uses url_title for Prev/Next Entry Pagination by default:

    {exp:channel:next_entry}
        Next entry: <a href="http://{path=site/comments}">{title}</a>
    {/exp:channel:next_entry}
    
    {exp:channel:prev_entry}
        Previous entry: <a href="http://{path=site/comments}">{title}</a>
    {/exp:channel:prev_entry}

    Is that not what you are looking for?

    Cheers,

  • #7 / Apr 16, 2012 11:29am

    Rommel

    14 posts

    Hi Rommel,

    I’m glad to see you have found a solution that suits your needs! I would like to point out that the current release of ExpressionEngine uses url_title for Prev/Next Entry Pagination by default:

    {exp:channel:next_entry}
        Next entry: <a href="http://{path=site/comments}">{title}</a>
    {/exp:channel:next_entry}
    
    {exp:channel:prev_entry}
        Previous entry: <a href="http://{path=site/comments}">{title}</a>
    {/exp:channel:prev_entry}

    Is that not what you are looking for?

    Cheers,

    Does that work when the domain is domain.com

    Because that was my problem, I can’t use that when the URL is domain.com instead of domain.com/news/id/1. I use the entry linking now indeed, but I can only use it when I redirect the visitors first. 😉

  • #8 / Apr 18, 2012 5:16pm

    Shane Eckert

    7174 posts

    Hey Rommel,

    Can I see how you are trying to do this?

    This should work regardless of how you get to the page. Have you tried this? Does it work for you?

    Please let me know.

    Cheers,

  • #9 / Apr 18, 2012 5:39pm

    Rommel

    14 posts

    Hey Shane,

    I made a test page special for you 😊 Here can you see the page. The code on this page is this:

    {exp:channel:entries limit="1" channel="days" disable="trackbacks|member_data|category_fields|categories" orderby="entry_id" cache="yes" refresh="60"}
        {embed="embeds/header" pagetitle="{title}"}
     <div class="animage">
      <div class="oneday">
       {static-domain}animageoneday.php
    {/exp:channel:entries}
    {exp:channel:next_entry}
     <a href="http://{url_title}" title="{title}" class="next">Next</a>
    {/exp:channel:next_entry}
    {exp:channel:prev_entry}
     <a href="http://{url_title}" title="{title}" class="prev">Prev</a>
    {/exp:channel:prev_entry}
      </div>
     </div>
    {embed="embeds/footer"}

    The problem was that the next en previous are not showing up. Here can you see the exact same page the only difference is the URL and see there: the next and previous buttons are working fine there, The next and previous buttons only show up when the URL have april-18-2012.

  • #10 / Apr 19, 2012 1:58pm

    Shane Eckert

    7174 posts

    Hi Rommel,

    I understand now. without a URL title to tell the tag where it is (dynamic), it’s not going to work.

    I am glad you found a solution though.

    Is there anything else I can help you with?

    Cheers,

  • #11 / Apr 19, 2012 2:17pm

    Rommel

    14 posts

    Indeed, yes… you can mark this topic as solved 😊 THX for the help!

  • #12 / Apr 19, 2012 2:18pm

    Shane Eckert

    7174 posts

    Hey Rommel,

    Awesome.

    If you need anything else, please just let us know by opening a new thread.

    Cheers,

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

ExpressionEngine News!

#eecms, #events, #releases