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.

Not your ordinary pagination question…

January 24, 2011 8:38am

Subscribe [4]
  • #1 / Jan 24, 2011 8:38am

    gazaston

    128 posts

    Hi all,

    I’ve set up the ‘blog’ section of my site using this Tumblr-type setup.

    However, it’s meant that pagination and date archives are a bit borked. I guess it’s something to do with the conditionals on the URL segment as described in the article — anybody got any ideas for a workaround?

  • #2 / Jan 24, 2011 3:09pm

    Ingmar

    29245 posts

    What version and build of EE are you using? Do you’ve got a link, perhaps a bit of sample code? What, exactly, isn’t working as intended?

  • #3 / Jan 24, 2011 3:28pm

    gazaston

    128 posts

    Hi Ingmar,

    I’m on version 2.1.1. It’s a local dev server do no link I’m afraid. I’ll describe the scenario and show some code.

    My blog has it’s own template group (‘journal’), with three templates: index.html, journal-main.html, and journal-article.html. index.html uses a conditional — here’s the code:

    {if segment_2 == ""}
    {embed="journal/journal-main"}
    {if:else}
    {embed="journal/journal-article"}
    {/if}

    journal-main uses a series of conditionals to display a list of posts in the usual way:

    {embed="pages/header"}
    
    <section id="container" class="group">
    
        
        <section id="journal-container" class="group">
        
        {exp:channel:entries channel="journal-entry|journal-link|journal-photo|journal-quote|journal-video" limit="2" orderby="date" paginate="bottom"}
        
        
        {paginate}
        
        {if previous_page}
        <a href="http://{auto_path}class=prev-page">Previous Page</a>  
        
        {/if}
        
        {if next_page}
        
        <a href="http://{auto_path}class=next-page">Next Page</a>
        
        {/if}
        
        {/paginate}
        
        
          {if channel_short_name == 'journal-link'}
          <div class="link">
              <h2><a href="http://{journal-link-URL}" target="_blank" rel="noopener">{title}</a></h2>
    <p>          {journal-link-description}<br />
              <span class="date">Posted on <strong>{entry_date format="%F %j, %Y"}</strong>  |  <a href="http://{title_permalink=">Permalink</a></span><br />
              <!-- <div class="back-to-top"><a href="#top">{site_url}/images/site-images/back-to-top.png</a></div> --><br />
          </div><br />
          <br />
          {if:elseif channel_short_name == 'journal-quote'}<br />
          <div class="quote"><br />
              </p><h2><a href="http://{journal-quote-URL}">{title}</a></h2>
    <p>          </p><blockquote><p>{journal-quote}</p>
    </blockquote>
    <p>          <span class="source"><a href="http://{journal-quote-URL}">{journal-quote-source}</a></span><br />
              {journal-quote-description}<br />
              <span class="date">Posted on <strong>{entry_date format="%F %j, %Y"}</strong>  |  <a href="http://{title_permalink=">Permalink</a></span><br />
              <!-- <div class="back-to-top"><a href="#top">{site_url}/images/site-images/back-to-top.png</a></div> --><br />
          </div><br />
          <br />
          {if:elseif channel_short_name == 'journal-entry'}<br />
          <div class="entry"><br />
              </p><h2><a href="http://{title_permalink=">{title}</a></h2>
    <p>          <!-- <span class="author">Written by <strong>{author}</strong></span> --><br />
              {journal-entry-summary} <span class="read-more"><a href="http://{title_permalink=">Read More…</a></span><br />
              <span class="date">Posted on <strong>{entry_date format="%F %j, %Y"}</strong>  |  <a href="http://{title_permalink=">Permalink</a></span><br />
              <!-- <div class="back-to-top"><a href="#top">{site_url}/images/site-images/back-to-top.png</a></div> --><br />
          </div><br />
          <br />
          {if:elseif channel_short_name == 'journal-photo'}<br />
          <div class="photo"><br />
              </p><h2><a href="http://{title_permalink=">{title}</a></h2>
    <p>          <figure>{journal-photo-upload}</figure><br />
              {journal-photo-description}<br />
              <span class="date">Posted on <strong>{entry_date format="%F %j, %Y"}</strong>  |  <a href="http://{title_permalink=">Permalink</a></span><br />
              <!-- <div class="back-to-top"><a href="#top">{site_url}/images/site-images/back-to-top.png</a></div> --><br />
          </div><br />
          <br />
          {if:elseif channel_short_name == 'journal-video'}<br />
          <div class="video"><br />
              </p><h2><a href="http://{title_permalink=">{title}</a></h2>
    <p>          <div class="video-container"><br />
                  <!-- start of embed code --><br />
                  {exp:videoplayer src="{journal-video-embed}"}<br />
                  <br />
                  <!-- end of embed code --><br />
              </div><br />
              <br />
              {journal-video-description}<br />
              <span class="date">Posted on <strong>{entry_date format="%F %j, %Y"}</strong>  |  <a href="http://{title_permalink=">Permalink</a></span><br />
              <!-- <div class="back-to-top"><a href="#top">{site_url}/images/site-images/back-to-top.png</a></div> --><br />
          </div><br />
          <br />
          {/if}<br />
          <br />
             <br />
          <br />
        {/exp:channel:entries} <br />
        <br />
        </section><br />
        <br />
        <section id="journal-archives"><br />
        <br />
        </p><h2>Archives</h2>
    <p>    <br />
        {exp:channel:month_links channel="journal-entry|journal-link|journal-photo|journal-quote|journal-video" limit="50"}<br />
        <br />
        <a href="http://{path=journal/archives}">{month}, {year}</a></p>
    
    <p>    <br />
        {/exp:channel:month_links}<br />
        <br />
        <br />
        </section></p>
    
    <p></section></p>
    
    <p>{embed="pages/footer"}

    My problem is this.

    As you can see, journal-main.html has a monthly archive menu and next/prev pagination —  these don’t work, instead the links open the most recent individual article.

    I guess it’s something to do with the conditionals on index.html — but I can’t get my head around it.

    Any ideas?

  • #4 / Jan 25, 2011 8:41am

    gazaston

    128 posts

    Sorry for the quick bump — I could really use some help on this :(

  • #5 / Jan 25, 2011 7:26pm

    Sue Crocker

    26054 posts

    Hi, madebysplended.

    Pagination just gets the next and previous entry, if you’re using multiple channels, you’ll need to find a third party add-on, on Devot-ee.com

  • #6 / Jan 25, 2011 7:59pm

    KeithW

    138 posts

    Maybe the real gist of the question is that you want an index with multiple items and pagination,
    and clicking on any item in the index takes you to a detail display of just that single item.
    If this is what you want, then separate index and detail templates/URLs as described here
    may be the answer.

  • #7 / Jan 26, 2011 6:02am

    gazaston

    128 posts

    Hi Sue, Keith,

    I solved the issue (kind of) by dropping the index.html template, though it means I get longer, less pretty URLs (e.g. http://www.domain.com/journal/article/title-of-article, rather than http://www.domain.com/journal/title-of-article).

    I’d still be interested if there’s a workaround to preserve that URL structure.

  • #8 / Jan 26, 2011 4:37pm

    Ingmar

    29245 posts

    I am not aware of one, unfortunately. As Sue said, some custom code would likely be required. Please post again in case there’s anything else.

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

ExpressionEngine News!

#eecms, #events, #releases