I am trying to achieve 2 different things here theme the pager to get the proper markup output to the page and when the pager still shows the

  • even when there is nothing to display is there a way to remove it when it is empty ?

    Here is the markup I am trying to achieve:

    <a href="node/" class="prev icon-arrow-line-left">Previous</a>
    <a href="node/" class="next icon-arrow-line-right">Next</a>
    

    I have to use the custom-pager.tpl.php to accomplish this but no luck yet.

    As far as removing the li when empty - let me know if I can provide any other detail that will be helpful but I guess if I just dont wrap it remove it completely and I can go off the link class

    thanks

  • Comments

    naeluh’s picture

    Ok so I was able to answer my first question

    I got this

    <ul class="custom-pager custom-pager-<?php print $position; ?>">
    <?php $href = !empty($nav_array['prev']) ? 'node/'. $nav_array['prev'] : NULL;?>
    <li class="previous"><?php print l(t(Previous), $href, array('attributes' => array('class' => 'prev icon-arrow-line-left'))); ?></li>
    <li class="key"><?php print $key; ?></li>
    <?php $href = !empty($nav_array['next']) ? 'node/'. $nav_array['next'] : NULL ?>
    <li class="next"><?php print l(t(Next), $href, array('attributes' => array('class' => 'next icon-arrow-line-right'))); ?></li>
    </ul>
    

    Now if any one possible can tell how to hide the prev when its empty that would be great thanks !

    ykyuen’s picture

    how about this?

    <ul class="custom-pager custom-pager-<?php print $position; ?>">
      <?php $href = !empty($nav_array['prev']) ? 'node/'. $nav_array['prev'] : NULL;?>
      <?php if ($href == NULL): ?>
        <li class="previous"><?php print l(t(Previous), $href, array('attributes' => array('class' => 'prev icon-arrow-line-left'))); ?></li>
      <?php endif; ?>
      <li class="key"><?php print $key; ?></li>
      <?php $href = !empty($nav_array['next']) ? 'node/'. $nav_array['next'] : NULL ?>
      <?php if ($href == NULL): ?>
        <li class="next"><?php print l(t(Next), $href, array('attributes' => array('class' => 'next icon-arrow-line-right'))); ?></li>
      <?php endif; ?>
    </ul>