[TYPO3-mvc] Re: Pager partial template
Nils Blattner
nb at cabag.ch
Fri Feb 19 10:19:29 CET 2010
Usage is straightforward:
<f:render partial="pager" arguments="{arguments: {keyword: keyword,
group: group, groups: groups}, page: page, lastPage: lastPage}" />
{namespace steps=Tx_CabagSteps_ViewHelpers}
<steps:appendArray array="{arguments}" key="lastPage" value="{lastPage}"
alias="args">
<div class="pagerContainer">
<ul class="pager">
<li class="first hidden">
<f:link.action action="search" arguments="{steps:appendArray(array:
args, key: 'page', value: 1)}">
<f:translate key="pager.first" />
</f:link.action>
</li>
<f:if condition="{page} > 1">
<li class="back">
<steps:appendArray array="{args}" key="page" value="{steps:sub(arg1:
page, arg2: 1)}" alias="linkArguments">
<f:link.action action="search" arguments="{linkArguments}">
<f:translate key="pager.back" />
</f:link.action>
</steps:appendArray>
</li>
</f:if>
<f:if condition="{steps:sub(arg1: page, arg2: 2)} > 1">
<li class="moreAfter">
...
</li>
</f:if>
<f:for each="{0: 1, 1: 2, 2: 3, 3: 4, 4: 5}" as="t_p" key="index">
<steps:singleAlias key="p" value="{steps:sub(arg1: t_p, arg2: 3)}">
<steps:appendArray array="{args}" key="page"
value="{steps:add(arg1: page, arg2: p)}" alias="linkArguments">
<f:if condition="{linkArguments.page} >= 1">
<f:if condition="{linkArguments.page} <= {lastPage}">
<f:if condition="{linkArguments.page} == {page}">
<f:then>
<li class="direct active">
<f:link.action action="search" arguments="{linkArguments}">
{linkArguments.page}
</f:link.action>
</li>
</f:then>
<f:else>
<li class="direct">
<f:link.action action="search" arguments="{linkArguments}">
{linkArguments.page}
</f:link.action>
</li>
</f:else>
</f:if>
</f:if>
</f:if>
</steps:appendArray>
</steps:singleAlias>
</f:for>
<f:if condition="{steps:add(arg1: page, arg2: 2)} < {lastPage}">
<li class="moreAfter">
...
</li>
</f:if>
<f:if condition="{page} < {lastPage}">
<li class="next">
<steps:appendArray array="{args}" key="page" value="{steps:add(arg1:
page, arg2: 1)}" alias="linkArguments">
<f:link.action action="search" arguments="{linkArguments}">
<f:translate key="pager.next" />
</f:link.action>
</steps:appendArray>
</li>
</f:if>
<li class="last hidden">
<f:link.action action="search" arguments="{steps:appendArray(array:
args, key: 'page', value: lastPage)}">
<f:translate key="pager.last" />
</f:link.action>
</li>
</ul>
</div>
</steps:appendArray>
More information about the TYPO3-project-typo3v4mvc
mailing list