pagination sample
This commit is contained in:
@@ -220,7 +220,11 @@ class TheliaLoop implements SmartyPluginInterface
|
||||
// Find pagination
|
||||
$pagination = self::getPagination($loopName);
|
||||
if ($pagination === null) {
|
||||
throw new \InvalidArgumentException("Loop $loopName : no pagination found.");
|
||||
throw new \InvalidArgumentException("Loop $loopName is not defined");
|
||||
}
|
||||
|
||||
if($pagination->getNbResults() == 0) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if ($content === null) {
|
||||
|
||||
55
templates/smarty-sample/pagination.html
Executable file
55
templates/smarty-sample/pagination.html
Executable file
@@ -0,0 +1,55 @@
|
||||
{assign var=category_current_page value={$smarty.get.category_page|default:1}}
|
||||
|
||||
<h1>Pagination</h1>
|
||||
|
||||
<h2>Categories</h2>
|
||||
|
||||
<div style="border: solid 1px; padding: 20px;">
|
||||
|
||||
{loop name="cat" type="category" page="{$category_current_page}" limit="2"}
|
||||
<h2>#LOOP_COUNT - #TITLE</h2>
|
||||
<h3>Products :</h3>
|
||||
|
||||
<div style="border: solid 1px; padding: 20px;">
|
||||
|
||||
{assign var=this_product_getter value="product_`$ID`_page"}
|
||||
|
||||
{assign var=product_current_page value={$smarty.get.$this_product_getter|default:1}}
|
||||
|
||||
<ul>
|
||||
{loop name="prod" type="product" category="#ID" page="{$product_current_page}" limit="2"}
|
||||
<li>
|
||||
#REF
|
||||
</li>
|
||||
{/loop}
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
<p>#TITLE page choice</p>
|
||||
{pageloop rel="prod"}
|
||||
{if ${PAGE} != {$product_current_page}}
|
||||
<a href="index_dev.php?view=pagination&category_page={$category_current_page}&{$this_product_getter}=#PAGE">#PAGE</a>
|
||||
{else}
|
||||
{ #PAGE }
|
||||
{/if}
|
||||
{if {$PAGE} != {$LAST}}
|
||||
-
|
||||
{/if}
|
||||
{/pageloop}
|
||||
|
||||
{/loop}
|
||||
|
||||
</div>
|
||||
|
||||
<p>categories page choice</p>
|
||||
{pageloop rel="cat"}
|
||||
{if ${PAGE} != {$category_current_page}}
|
||||
<a href="index_dev.php?view=pagination&category_page=#PAGE">#PAGE</a>
|
||||
{else}
|
||||
{ #PAGE }
|
||||
{/if}
|
||||
{if {$PAGE} != {$LAST}}
|
||||
-
|
||||
{/if}
|
||||
{/pageloop}
|
||||
Reference in New Issue
Block a user