1 cyclist Feb 28, 2006 13:15
3 cyclist Feb 28, 2006 16:01
Thanks but this doesn't help me much. I don't want to add span tags which have no use other than adding a class which usually is added directly to the link tags. I simply want to add the classes to the <a href=....>. There must be some part in the code of the script where to do it. I just haven't found it. It's definitly not in the skin files but probably somewhere in the functions.
4 yabba Feb 28, 2006 17:01
In that case you need to look in b2evocore/_functions_b2posts.php (or something like that) for the two functions that you need to hack. A minimal hack would be to add a parameter for the class name, that way you'll have less work to do if you ever upgrade (or if they change the params).
function next_posts_link($label='#',$link_class = 'next', $max_page=0, $page='')
{
global $p, $paged, $result, $request, $Settings;
if( $label == '#' ) $label = T_('Next Page').' >>';
if ($Settings->get('what_to_show') == 'paged')
{
global $MainList;
if (!$max_page) $max_page = $MainList->get_max_paged();
if (!$paged) $paged = 1;
$nextpage = intval($paged) + 1;
if (empty($p) && (empty($paged) || $nextpage <= $max_page))
{
echo '<a href="';
echo next_posts($max_page, $page);
echo '" class="'.$link_class.'">'. htmlspecialchars($label) .'</a>';
}
}
}
/**
* previous_posts_link(-)
*
*
*/
function previous_posts_link($label='#',$link_class = 'prev' ,$page='')
{
global $Settings;
if( $label == '#' ) $label = '<< '.T_('Previous Page');
global $p, $paged;
if (empty($p) && ($paged > 1) && ($Settings->get('what_to_show') == 'paged'))
{
echo '<a href="';
echo previous_posts( $page );
echo '" class="'.$link_class.'">'. htmlspecialchars($label) .'</a>';
}
}
and then call them in your skin with
previous_posts_link( 'Previous posts' , 'my_previous_class');
next_posts_link( 'Next posts', 'my_next_class' );
¥
5 cyclist Feb 28, 2006 22:18
Thanks a lot. It didn't work for me how you suggested since I couldn't find the place in my skin but anway I changed it directly in the functions
echo '<a class="prev" href="';
echo previous_posts( $page );
echo '" class="'.$link_class.'">'. htmlspecialchars($label) .'</a>';
But without your help I simply didn't find the place in the functions although searching.
At least this works for me.
6 ole Nov 11, 2006 00:14
Nice tip. Helped me a lot. Thank you.
In your skins use :-
¥