Recent Topics

1 Nov 24, 2006 21:03    

I used this: http://manual.b2evolution.net/Recent_posts_in_the_sidebar to list the five most recent posts in the sidebar of my blog (that I'm testing). But I don't want the entire text from the post to show up in the sidebar, just the title and maybe the first 50 words or so, perhaps followed by a link to the actual post. I tried changing the $Item->content parameters, but to no avail. How would I go about doing this? Apologies if I posted this in the wrong place, or otherwise said something stupid, but I'm a newbie.

2 Jan 17, 2007 02:18

I was looking to do the same thing...

I was using the _sideblog_plugin.php and this works as long as there is only 1 post in 1 category....

function wordCut($text, $limit, $msg){
if (strlen($text) > $limit){
$txt1 = wordwrap($text, $limit, '[cut]');
$txt2 = explode('[cut]', $txt1);
$ourTxt = $txt2[0];
$finalTxt = $ourTxt.$msg;
}else{
$finalTxt = $text;
}
return $finalTxt;
}

if ($params['showpostcontent'])
echo '<br><br>';
echo wordCut($Item->content, 600);
echo '<br>';
echo '<a href="';
$Item->permanent_url();
echo '">';
echo '... read more';
echo '</a>';
echo $params['line_end'];
}

If anyone who knows PH better than me can get this to work with more than one post in more than one category... Please let me know... I have beat my brains out with this and cannot get it to work... I don't know PHP that well. :( I actually found this on PHP.net.


Form is loading...