Jump to content

Gallery - New Pagination


cpugeek

Recommended Posts

Ok, let me get started by saying:1. I know this probably shouldn't be posted here, but I can't get any help on it.2. It's for an application called Gallery 2 (http://gallery.menalto.com/)3. Please give it a thought (or two), because I can't get it to work, and it's getting fairly annoying.Now, Gallery 2 uses 2 templates for Pagination: Navigator.tpl & Pager.tplwhich results in this:post-6055-1226217305_thumb.jpgI'm aiming for something like this: [<< First][< Previous] [1] [2] [3] [4] [5] [...] [21] [Next >][Last >>]Which combines both of the templatesAnd Last but not Least:The code for Navigator.tpl:

{if isset($reverseOrder) && $reverseOrder}  {assign var="order" value="next-and-last current first-and-previous"}{else}  {assign var="order" value="first-and-previous current next-and-last"}{/if}{assign var="prefix" value=$prefix|default:""}{assign var="suffix" value=$suffix|default:""}{* * The strip calls in this tpl are to avoid a safari bug where padding-right is lost * in floated containers for elements that have whitespace before the closing tag. *}<div class="{$class}">{foreach from=$order|split item="which"}{if $which=="next-and-last"}  <div class="next-and-last{if !isset($navigator.first) &&				   !isset($navigator.back)} no-previous{/if}">	{strip}	{if isset($navigator.next)}	{* Uncomment to omit next when same as last:	&& (!isset($navigator.last) || $navigator.next.urlParams != $navigator.last.urlParams)} *}	<a href="{g->url params=$navigator.next.urlParams}" class="next">	  {g->text text="next"}{$suffix}	  {if isset($navigator.next.thumbnail)}	{g->image item=$navigator.next.item image=$navigator.next.thumbnail		  maxSize=40 class="next"}	  {/if}	</a>	{/if}	{if isset($navigator.last)}	<a href="{g->url params=$navigator.last.urlParams}" class="last">	  {g->text text="last"}{$suffix}	  {if isset($navigator.last.thumbnail)}	{g->image item=$navigator.last.item image=$navigator.last.thumbnail		  maxSize=40 class="last"}	  {/if}	</a>	{/if}	{/strip}  </div>{elseif $which=="current"}  {if (isset($currentPage) && isset($totalPages)) || (isset($currentItem) && isset($totalItems))}  <span class="current">	{if isset($currentPage)}	  {g->text text="Page %d of %d" arg1=$currentPage arg2=$totalPages}	{else}	  {if isset($currentItem)}	{g->text text="%d of %d" arg1=$currentItem arg2=$totalItems}	  {/if}	{/if}  </span>  {/if}{else}  <div class="first-and-previous">	{strip}	{if isset($navigator.first)}	<a href="{g->url params=$navigator.first.urlParams}" class="first">	  {if isset($navigator.first.thumbnail)}	{g->image item=$navigator.first.item image=$navigator.first.thumbnail		  maxSize="40" class="first"}	  {/if}	  {$prefix}{g->text text="first"}	</a>	{/if}	{if isset($navigator.back)}	{* Uncomment to omit previous when same as first:	&& (!isset($navigator.first) || $navigator.back.urlParams != $navigator.first.urlParams)} *}	<a href="{g->url params=$navigator.back.urlParams}" class="previous">	  {if isset($navigator.back.thumbnail)}	{g->image item=$navigator.back.item image=$navigator.back.thumbnail		  maxSize="40" class="previous"}	  {/if}	  {$prefix}{g->text text="previous"}	</a>	{/if}	{/strip}  </div>{/if}{/foreach}</div>

and the code for Pager.tpl:

{*<div class="{$class}">  {g->text text="Page:"}  {assign var="lastPage" value=0}  {foreach name=jumpRange from=$theme.jumpRange item=page}  {if ($page - $lastPage >= 2)}  <span>	{if ($page - $lastPage == 2)}	<a href="{g->url params=$theme.pageUrl arg1="page=`$page-1`"}">{$page-1}</a>	{else}	...	{/if}  </span>  {/if}  <span>	{if ($theme.currentPage == $page)}	{$page}	{else}	<a href="{g->url params=$theme.pageUrl arg1="page=$page"}">{$page}</a>	{/if}  </span>  {assign var="lastPage" value=$page}  {/foreach}<a href="{g->url arg1="view=core.ShowItem" arg2="itemId=`$theme.item.id`" arg3="page=0" arg4="showAll=true"}">Show All</a></div>

As Always Any and All help is Appreciated. :)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...