Add Condition to prev/next nagivator?

Mr. B

Joined: 2005-10-09
Posts: 25
Posted: Fri, 2010-07-23 03:07

I have replaced the standard core.Navigator block with my own code so I can use an CSS sprite image rollover for the previous and next buttons. The code appears as follows.

{* Navigator *}
{if !empty($theme.navigator)}
{g->callback type="core.LoadPeers" item=$theme.item windowSize=1}
    <ul class="navButton aR">
      <li class="buttonPrev"><a href="{g->url params=$theme.navigator.back.urlParams}" class="previous"></a><span class="displace">Previous</span></li>
      <li class="current">{g->text text="%d of %d" arg1=$block.core.LoadPeers.thisPeerIndex arg2=$block.core.LoadPeers.peerCount}</li>
      <li class="buttonNext"><a href="{g->url params=$theme.navigator.next.urlParams}" class="next"></a><span class="displace">Next</span></li>
    </ul>
{/if}

The only problem is the buttons remain even if there is no previous or next item... when viewing the first and last images in an album. Is there a way to add a condition to my existing code for the two button? I looked at navigator.tpl and as far as i can tell if has three separate scenarios to accommodate this issue. I am hoping to avoid that level of complication.