<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="application/vnd.wap.xhtml+xml; charset=utf-8" />
    <meta name="viewport" content="width=device-width,initial-scale=1" />
    <title>XtGem.com</title>
</head>
<body>
<div class="xt_container" data-xtcontainer="title">
<xt:text><h6 style="display:block;text-align: center;">Blog and filelist <br />
custom paging</h6></xt:text><xt:text>This Xtscript will create a custom paging using Xtgem template classes for Xtgems blog or filelist function The script must go just above the Blog or Filelist function </xt:text><br />
</div>
<div class="xt_container" data-xtcontainer="item"><xt:code><!--parser:xtscript-->
function paging_template $url;$page;$active_page;$total_pages; 

assign $button=<a class="xt_button" href="$url">$page</a>

if $page == 1
print <div class="xt_container" style="margin:0 auto;text-align:center">
print <a class="xt_button" href="$url">|&lt;</a>
endif

if ($page+1) == $active_page
print <a class="xt_button" href="$url">prev</a>
elseif ($page+2) == $active_page 
print $button
elseif ($page+3) == $active_page 
print $button
elseif ($page+4) == $active_page 
print $button

elseif $page == $active_page 
print <span class="xt_button" style="color:#f00" >$page</span>

elseif ($page-1) == $active_page 
print <a class="xt_button" href="$url">next</a>
elseif ($page-2) == $active_page 
print $button 
elseif ($page-3) == $active_page 
print $button 
elseif ($page-4) == $active_page 
print $button 
endif

if $page == $total_pages
print <a class="xt_button" href="$url">&gt;|</a>
print </div>
endif
endfunction
<!--/parser:xtscript--> 
</xt:code>
<xt:text><h6 style="display:block;text-align: center;">Example</h6></xt:text><xt:filelist sort_type="name" sort_dir="asc" folder="/manual/xtgem/folder" template="" per_page="5" />
</div>
<div class="xt_container" data-xtcontainer="code">
<xt:text><h6 style="display:block;text-align: center;">html code</h6></xt:text>
<xt:code>
<div class="xt_textarea">
<textarea style="min-height:20em;width:100%">
&lt;!--parser:xtscript--&gt;
function paging_template $url;$page;$active_page;$total_pages; 

assign $button=&lt;a class=&quot;xt_button&quot; href=&quot;$url&quot;&gt;$page&lt;/a&gt;

if $page == 1
print &lt;div class=&quot;xt_container&quot; style=&quot;margin:0 auto;text-align:center&quot;&gt;
print &lt;a class=&quot;xt_button&quot; href=&quot;$url&quot;&gt;|&amp;lt;&lt;/a&gt;
endif

if ($page+1) == $active_page
print &lt;a class=&quot;xt_button&quot; href=&quot;$url&quot;&gt;prev&lt;/a&gt;
elseif ($page+2) == $active_page 
print $button
elseif ($page+3) == $active_page 
print $button
elseif ($page+4) == $active_page 
print $button

elseif $page == $active_page 
print &lt;span class=&quot;xt_button&quot; style=&quot;color:#f00&quot; &gt;$page&lt;/span&gt;

elseif ($page-1) == $active_page 
print &lt;a class=&quot;xt_button&quot; href=&quot;$url&quot;&gt;next&lt;/a&gt;
elseif ($page-2) == $active_page 
print $button 
elseif ($page-3) == $active_page 
print $button 
elseif ($page-4) == $active_page 
print $button 
endif

if $page == $total_pages
print &lt;a class=&quot;xt_button&quot; href=&quot;$url&quot;&gt;&amp;gt;|&lt;/a&gt;
print &lt;/div&gt;
endif
endfunction
&lt;!--/parser:xtscript--&gt; 
</textarea>
</div></xt:code>
</div>
</body>
</html>
