1 nomad Jul 21, 2005 18:56
3 nomad Jul 21, 2005 21:36
No, unfortunately not. My profile links to my current blog which I'm about to transfer to b2evolution.
4 personman Jul 21, 2005 22:17
Oh, sorry about that. I haven't seen any hacks to that effect, but you might be able to create one. In the meantime, the archives links in your sidebar and the calendar serve similar purposes.
5 isaac Jul 22, 2005 01:04
I had created this for my skin, [url=http://isaacschlueter.com/all?skin=autumn]autumn[/url]. It should still work fine.
Add this function somewhere, and then call it with the appropriate params where you want to show your page numbers:
/*
* posts_nav_link_number(-)
*
*/
function posts_nav_link_number($before='', $after='', $pagelink='%', $pagedgroup='5', $page='')
{
global $MainList, $paged, $result, $request, $posts_per_page, $what_to_show;
$p = $MainList->$p;
if( empty($p) && ($what_to_show == 'paged') && isset($MainList) )
{
$max_page = $MainList->get_max_paged();
if( $max_page > 1 )
{
echo $before;
$saved_paged = $paged;
if(!$paged) $paged=1;
$curr_paged = $paged;
//find the $pagedgroup that we're in
for($j=0; ($j*$pagedgroup) < $paged; $j++);
$i=$j-1;
//echo "\$i=$i; \$j=$j; \$k=$k; \$max_page=$max_page;";
if($i > 0) {
// echo '<a href="';
// echo regenerate_url( 'paged', 'paged='.'1',$page);
// echo '">'.str_replace('%','1',$pagelink).'</a> ';
echo '<a href="';
echo regenerate_url( 'paged', 'paged='.($i*$pagedgroup),$page);
echo '">«</a> ';
}
//echo "\$i=$i; \$j=$j; \$k=;$k; ";
for( $k=($i * $pagedgroup) + 1; ($k <= ($j * $pagedgroup) ) && $k <= $max_page; $k++) {
if($k != $paged) {
echo '<a href="';
echo regenerate_url( 'paged', 'paged='.$k,$page);
echo '">';
}
echo str_replace('%',$k,$pagelink);
if($paged != $k) echo '</a> '; else echo ' ';
//echo "\$i=$i; \$j=$j; \$k=$k; ";
}
//echo "\$i=$i; \$j=$j; \$k=$k; ";
if ( $k <= $max_page)
{
//echo "\$i=$i; \$j=$j; \$k=$k; ";
echo '<a href="';
echo regenerate_url( 'paged', 'paged=' . $k ,$page);
echo '">»</a> ';
// echo '<a href="';
// echo regenerate_url( 'paged', 'paged='. $max_page, $page);
// echo '">'.str_replace('%',$max_page,$pagelink).'</a>';
}
}
$paged=$saved_paged;
echo $after;
}
}
6 nomad Jul 22, 2005 01:28
Hey thanks! I'll try it tomorrow morning.
As I'm a PHP-beginner... By "call it with the appropriate params" you mean something like this?
<?php require( dirname(__FILE__).'/_pagenumbers.php' ); ?>
PS: I couldn't find your autumn-skin on the list of skins on http://skins.b2evolution.net/
7 personman Jul 22, 2005 02:55
Not quite like that. Add Isaac's code to one of the function library files that are already getting included (or better yet, create a file called /conf/hacks.php and save the code in there: it will get included automatically). That will define the function. Then in your _main.php file you use it like this:
<?php
posts_nav_link_number($before='<div class="navlink">', $after='</div>', $pagelink='%', $pagedgroup='5', $page='');
?>
Wherever you put that code, it will display the page numbers. You can customize the way it looks by changing what's in the $before parameter (combined with your css). And play around with the other parameters to see what they do.
Isaac, I like that skin.
8 isaac Jul 22, 2005 05:15
Thanks, personman. It's way out of date, and I really want it to be updated before making public.
Actually, though, you don't have to use the variable names in the function call. Just stick something like this where you want to have the list show up:
<?php posts_nav_link_number('goes before the list', 'goes after the list', 'page number [%]', '5');?>
or, if you just want to use the default settings:
<?php posts_nav_link_number(); ?>
9 nomad Jul 22, 2005 09:54
Something went wrong. I created the file as personman said - both in conf and afterwards also in b2evocore but it wasn't included or called. Instead, the sidebar and the footer disappeared. This is the error message. Would be glad for help. Thanks!
PHP Fatal error: Call to undefined function: posts_nav_link_number() in /home/users/antropologi/www/blog/skins/clean/_main.php on line 148
10 personman Jul 22, 2005 14:15
That error means that you're not getting the function defined properly. In the conf/hacks.php make sure the file begins with
<?php
and ends with
?>
That's probably all you're missing. If that doesn't do the trick, then you could tack Isaac's code (including the opening and closing tags above) onto the end of b2evocore/_funtions_skins.php.
The variable names aren't neccessary when you call the function, but I left them in my example so you could see what each param was doing.
11 nomad Jul 22, 2005 14:38
Thanks! I had added the <php before, but it was your advice to "tack Isaac's code onto the end of b2evocore/_funtions_skins.php" that made it work!
:D
Looks like you got it working. Care to share how you did it?