Info
- 9 posts
- 5 voices
- Started 2 years ago by bbiSimone
- Latest reply from chandersbs
- This topic is not resolved
How to Show Last Ten Posts in Sidebar?
-
- Posted 2 years ago #
I'm trying to show the last ten posts in my sidebar, but I am not entirely succeeding, what am I doing wrong? I thought I'd just need to adjust the code from latest discussion a bit. Obviously it doesn't work like that.
<table class="recent_posts" cellspacing="0" width="100%"> <?php if ( $topics ) : foreach ( $topics as $topic ) : ?> <tr<?php topic_class(); ?>> <td><?php bb_topic_labels(); ?> <a href="<?php topic_link(); ?>"><?php topic_title(); ?></a></td> <td><small><a href="<?php topic_last_post_link(); ?>"><?php topic_time(); ?></a></small></td> </tr> <?php endforeach; endif; // $topics ?> </table>So how can I call the latest ten posts in the sidebar?
-
- Posted 2 years ago #
You mean the last 10 replies?
-
- Posted 2 years ago #
Nope just the last ten posts that were started. Since you cannot see those from the single topic. Flickr's a good example: http://www.flickr.com/help/forum/en-us/93226/
-
- Posted 2 years ago #
That code seems to work fine here, what problems are you having? Apart from not having any limiter to keep it at 10 topics anyway.
-
- Posted 2 years ago #
i tried this code as well, to generate a list of 10 last topics in my sidebar. But its not showing any topics at all.
-
- Posted 2 years ago #
That might be interfering with the loop. try with a new query variable
-
- Posted 2 years ago #
Like?
-
- Posted 2 years ago #
Yeah, it has some very AWESOME code in there, this code generates a list of topics that was active as last:
<?php if ( bb_forums() ) : ?>
<h3>Actieve onderwerpen</h3>
<ul style="color:#bbb;">
<?php
global $bbdb;
$query="SELECT * FROM bb_topics WHERE topic_status=0 ORDER BY topic_time DESC LIMIT 5";
$results=$bbdb->get_results($query);
foreach ($results as $result) {
echo "- topic_id."'>".$result->topic_title." (".$result->topic_posts.")
";
}
?><?php endif; ?>
I did some adjustment in the code, to make it work. SWEET.But not really what I was looking for, but o well.
-
You must log in to post.