2014-06-06, 23:41:44
(2013-08-13, 20:51:46)zhax90 Wrote: Hi,
First of all thank you for news manager great plugin but I wonder is there a possibility to display numbers of pages instead of "older posts", "newer posts" ??
Edit:
...so, I made pages numbering. There are many examples of this feature in web and it can be made in diffrent ways but I decide to do it by my own. It's a bit wordy but I wanted to make as least condition checks as posible. Tell me what you thinking about it and keep in mind I'm not php programmer.
PHP Code:function nm_show_navigation($index, $total) {
$url = nm_get_url('page');
echo '<div class="nm_page_nav">';
########
if($index==0){ ## if we're on first page
echo "[1] "; ## ...and rest of numbers as links
for($num=2;$num<=$total;$num++){
?>
<a href="<?php echo $url.($num-1); ?>">
<?php echo "[".$num."] "; ?>
</a>
<?php
}
}else{ ## first page as link
?>
<a href="<?php echo substr($url, 0, -6); ?>">
<?php echo "[1] "; ?>
</a>
<?php ## more!
for($num=2;$num<$index;++$num){
?>
<a href="<?php echo $url.($num); ?>">
<?php echo "[".$num."] "; ?>
</a>
<?php
}
?>
<?php ## echo current page
echo "[".($index+1)."] ";
?>
<?php ## if it's NOT last page...
if($index!=$total-1){
## ...echo rest of pages
for($num=$index+1;$num<=$total;++$num){
?>
<a href="<?php echo $url.($num); ?>">
<?php echo "[".$num."] "; ?>
</a>
<?php
}
}
}
#######
echo '</div>';
}
Hello, your code works. Thank you. Only during the transition to page 2 is displayed in the navigation page number twice. For example:
1 2 2 3 4 5
If you turn to page 3, then 4 is shown twice
Could you please help me?
Š•hank you