
It will produce something like this:
(second part of content)
>>
1. Add User Tag called stronicowanie (pagination in polish)
Code: Select all
function curPageURL() {
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
return $pageURL;
}
$content = $params['content'];
$strona = isset($params['page']) ? (int)$params['page'] : '1';
$content_ex = explode('[~~~~~~~~~~~~PAGE~~~~~~~~~~~~]',$content);
$ileStron = count($content_ex);
if ($strona < 1)
$strona = 1;
elseif ( $strona > $ileStron )
$strona = $ileStron;
echo $content_ex[$strona-1];
if($ileStron > 1)
{
echo '<br /> <div class="strony">';
$x = parse_url( curPageURL() ) ;
parse_str($x['query'], $output );
$url = 'index.php?' . http_build_query($output);
if ($strona > 1)
{
$output['stronicowanie'] = 1;
$url = 'index.php?' . http_build_query($output);
echo '<a href="'. $url .'"><<</a> ';
$output['stronicowanie'] = $strona-1;
$url = 'index.php?' . http_build_query($output);
echo '<a href="'. $url .'"><</a> ';
}
for ($i = 1; $i <= $ileStron; $i++)
{
if ($i == $strona)
{
echo ' <strong>['.$i.']</strong> ';
}
else
{
$output['stronicowanie'] = $i;
$url = 'index.php?' . http_build_query($output);
echo '<a href="'. $url .'">'.$i.'</a>';
}
if ($i != $ileStron)
echo ' - ';
}
if ($strona < $ileStron)
{
$output['stronicowanie'] = $strona+1;
$url = 'index.php?' . http_build_query($output);
echo ' <a href="'. $url .'">></a>';
$output['stronicowanie'] = $ileStron;
$url = 'index.php?' . http_build_query($output);
echo ' <a href="'. $url .'">>></a>';
}
echo '</div>';
}
Code: Select all
---|---
Insert break line|[~~~~~~~~~~~~PAGE~~~~~~~~~~~~]
Code: Select all
{capture name="content"}{content}{/capture}
{stronicowanie content=$smarty.capture.content page=$smarty.get.stronicowanie}

You should remember, that [~~~~~~~~~~~~PAGE~~~~~~~~~~~~] should not be surrounded by any other tags !!!
for example:
Code: Select all
<p>[~~~~~~~~~~~~PAGE~~~~~~~~~~~~]</p>
And next one will begin by