Answers.Body: <p>To do this, you would need to use <a href="http://buildwithcraft.com/docs/templating/entrymodel#getPrev" rel="nofollow">getPrev()</a> and <a href="http://buildwithcraft.com/docs/templating/entrymodel#getNext" rel="nofollow">getNext()</a> on the related entries’ template.</p>
  
  <p>The trick is telling getPrev() and getNext() to use the order you defined in the source entry’s Entries field.</p>
  
  <p>So first, you will need to get that source entry. If you only have a single entry in your structure section that has one of these Entries fields, that could be as simple as this:</p>
  
  <pre><code>{# Get the entry in the structure section that relates to `entry` %}
  {% set sourceEntry = craft.entries.section('myStructureSection').relatedTo({
      targetElement: entry,
      field: 'myEntriesField'
  }) %}
  </code></pre>
  
  <p>Once you have that, you can just pass its Entries field into getPrev() and getNext():</p>
  
  <pre><code>{% set prevEntry = entry.getPrev(sourceEntry.myEntriesField) %}
  {% set nextEntry = entry.getNext(sourceEntry.myEntriesField) %}
  
  {% if prevEntry %}
      &lt;a href="{{ prevEntry.url }}"&gt;Previous: {{ prevEntry.title }}&lt;/a&gt;
  {% endif %}
  
  {% if nextEntry %}
      &lt;a href="{{ nextEntry.url }}"&gt;Next: {{ nextEntry.title }}&lt;/a&gt;
  {% endif %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-13T23:43:54.100Z
Answers.Text: This is close but not quite there. I'm going to hack away at it and see if I can figure out why. I might rethink the way this is setup and just use a Structure for sorting purposes instead of a relationship.
Answers.UserDisplayName: Stuart McCoy
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-13T17:05:22.867Z
Answers.LastActivityDate: 2014-07-14T18:42:58.343Z
Answers.LastEditDate: 2014-07-14T18:42:58.343Z
Answers.UserDisplayName: Brandon Kelly
Body: <p>I have an entries field type associated with a structure section page. This displays the entries on this page in a particular order. When you click an entry link ti will take you to  a detailed page for more information about that entry. What I'd like to be able to do is paginate through these entries in the order set in the entries field, not just paginate through the entries in asc/desc or alphabetical order as would happen if I just paginated through the channel section that stores the entries.</p>
  
  <p>I tried straight forward pagination as detailed in the documentation but two problems occurred. First the pagination links were created with proper beginning end and number but when clicking through them you remained on the same entry. Second, a pagination URI was appended to the URL which I don't want.</p>
  
  <p>Is pagination even the proper approach to this problem or is there a better solution?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-06-13T16:11:27.547Z
Comments.Text: When you say you want to “paginate” through them, do you mean you want to list some number of them at a time (pagination), or just show links to the previous and next entries?
Comments.UserDisplayName: Brandon Kelly
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-06-13T16:17:45.567Z
Comments.Text: The latter. I started working through the advice below and am halfway through the solution, Just trying to figure out how to sort these by the entries field instead of relying on the order parameter.
Comments.UserDisplayName: Stuart McCoy
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-06-13T16:38:16.240Z
Comments.Text: Stuart, you should just change `title` in the parameters to the field you'd like your entries to be order by. (I am referring to [this answer](http://craftcms.stackexchange.com/a/58/125))
Comments.UserDisplayName: carlcs
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-06-13T16:58:16.300Z
Comments.Text: It doesn't appear to be that simple. I tried that first thing and got a CDbException error. Looking into relatedTo and seeing if I can maybe build this within an entries loop instead.
Comments.UserDisplayName: Stuart McCoy
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-06-13T17:23:25.750Z
Comments.Text: Sorry, I probably didn't read your question thoroughly. Chances are that @Brandon answer is what you are after. Deleting mine.
Comments.UserDisplayName: carlcs
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-06-13T18:25:45.463Z
Comments.Text: No, it definitely helped because I was barking up the wrong tree with pagination but the sort order is important and the straight up prevEntry/nextEntry wasn't enough on its own.
Comments.UserDisplayName: Stuart McCoy
Tags: <pagination><relations><previous-next><entries-field>
Title: What's the best way to paginate through entries from an entries field type?
ThreadText: # What's the best way to paginate through entries from an entries field type?
  
  (Asked by: username_0 on 2014-06-13)
  
  I have an entries field type associated with a structure section page. This displays the entries on this page in a particular order. When you click an entry link ti will take you to a detailed page for more information about that entry. What I'd like to be able to do is paginate through these entries in the order set in the entries field, not just paginate through the entries in asc/desc or alphabetical order as would happen if I just paginated through the channel section that stores the entries.
  
  I tried straight forward pagination as detailed in the documentation but two problems occurred. First the pagination links were created with proper beginning end and number but when clicking through them you remained on the same entry. Second, a pagination URI was appended to the URL which I don't want.
  
  Is pagination even the proper approach to this problem or is there a better solution?
  
  **Tags:** pagination, relations, previous-next, entries-field
  
  > **Comments:**
  > **username_1**: When you say you want to “paginate” through them, do you mean you want to list some number of them at a time (pagination), or just show links to the previous and next entries?  
  > **username_0**: The latter. I started working through the advice below and am halfway through the solution, Just trying to figure out how to sort these by the entries field instead of relying on the order parameter.  
  > **username_2**: username_0, you should just change `title` in the parameters to the field you'd like your entries to be order by. (I am referring to [this answer](http://craftcms.stackexchange.com/a/58/125))  
  > **username_0**: It doesn't appear to be that simple. I tried that first thing and got a CDbException error. Looking into relatedTo and seeing if I can maybe build this within an entries loop instead.  
  > **username_2**: Sorry, I probably didn't read your question thoroughly. Chances are that @username_1 answer is what you are after. Deleting mine.  
  > **username_0**: No, it definitely helped because I was barking up the wrong tree with pagination but the sort order is important and the straight up prevEntry/nextEntry wasn't enough on its own.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2014-06-13. Score: 4 | Accepted answer
  
  To do this, you would need to use [getPrev()](http://buildwithcraft.com/docs/templating/entrymodel#getPrev) and [getNext()](http://buildwithcraft.com/docs/templating/entrymodel#getNext) on the related entries’ template.
  
  The trick is telling getPrev() and getNext() to use the order you defined in the source entry’s Entries field.
  
  So first, you will need to get that source entry. If you only have a single entry in your structure section that has one of these Entries fields, that could be as simple as this:
  
  ```
  {# Get the entry in the structure section that relates to `entry` %}
  {% set sourceEntry = craft.entries.section('myStructureSection').relatedTo({
      targetElement: entry,
      field: 'myEntriesField'
  }) %}
  
  ```
  
  Once you have that, you can just pass its Entries field into getPrev() and getNext():
  
  ```
  {% set prevEntry = entry.getPrev(sourceEntry.myEntriesField) %}
  {% set nextEntry = entry.getNext(sourceEntry.myEntriesField) %}
  
  {% if prevEntry %}
      <a href="{{ prevEntry.url }}">Previous: {{ prevEntry.title }}</a>
  {% endif %}
  
  {% if nextEntry %}
      <a href="{{ nextEntry.url }}">Next: {{ nextEntry.title }}</a>
  {% endif %}
  
  ```
  
  > **Comments:**
  > **username_0**: This is close but not quite there. I'm going to hack away at it and see if I can figure out why. I might rethink the way this is setup and just use a Structure for sorting purposes instead of a relationship.  
  
  ---
  
  