markup dump
I think its about time we drop the <ul> <li> facination it dosnt really make sense imho

<nav class="pager">
  <span class="first"><a href="foo" title="Go to first page">« </a></span>
  <span class="pre"><a href="foo?page=2" title="Go to previous page">‹ </a></span>
  <span><a href="foo" title="Go to page 1">1</a></span>
  <span><a href="foo?page=1" title="Go to page 2">2</a></span>
  <span><a href="foo?page=2" title="Go to page 3">3</a></span>
  <span class="active"><b>4</b></span>
  <span><a href="foo?page=4" title="Go to page 5">5</a></span>
  <span><a href="foo?page=5" title="Go to page 6">6</a></span>
  <span><a href="foo?page=6" title="Go to page 7">7</a></span>
  <span><a href="foo?page=7" title="Go to page 8">8</a></span>
  <span><a href="foo?page=8" title="Go to page 9">9</a></span>
  <span>…</span>
  <span class="next"><a href="foo?page=4" title="Go to next page"> ›</a></span>
  <span class="last"><a href="foo?page=18334" title="Go to last page"> »</a></span>
</nav>

pager.html.twig:

{#
need the following variables
  first
  previous
  last
  next
  ellipsis  
  page_count
  current
 #}

{% if pager %}
<nav class="pager">
  {% if first is defined %}
    <span class="first">
      <a href="{{ url }}" title=" {{ help text }}">« </a>
    </span>
  {% endif %}

  {% if previous is defined %}
    <span class="pre">
      <a href="{{ url }}" title=" {{ help text }}">‹ </a>
    </span>
  {% endif %}

  {% for page in page_count %}
    {% if page != current %}
      <span>
        <a href="{{ url }}" title=" {{ help text }}">{{ count }}</a>
      </span>
    {% else %}
      <span class="active"><b>{{ count }}</b></span>
    {% endif %}
  {% endfor %}

  {% if ellipsis is defined %}
    <span>...</span>
  {% endif %}

  {% if next is defined %}
    <span class="next">
      <a href="{{ url }}" title=" {{ help text }}"> ›</a>
    </span>
  {% endif %}

  {% if last is defined %}
    <span class="last">
      <a href="{{ url }}" title=" {{ help text }}"> »</a>
    </span>
  {% endif %}
</nav>
{% endif %}

got pointed to some good info here about pagers at the sprint in sydney
https://github.com/KnpLabs/KnpPaginatorBundle

Comments

steveoliver’s picture

i suppose so — pagers are never going to be hierarchical :)

jwilson3’s picture

jwilson3’s picture

The sample code above is also missing rel=prev and rel=next.

jwilson3’s picture

Status: Active » Closed (duplicate)

morten, since you copied your comment from here already over to the other one, lets just call this a dupe.

jwilson3’s picture

Issue summary: View changes

link to inspiration