Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.

+ How can you display hot questions in sidebar?

+5 votes
515 views
asked May 26, 2011 in Q2A Core by Aslan
edited Jun 5, 2011 by Aslan
Does anyone know how to do that?

I already have most popular users in sidebar, but I also want the top 3 of hot questions in the sidebar... but I dont know how... maybe someone has already done it?

I will  be really grateful!!

5 Answers

+1 vote
answered Sep 28, 2011 by myquealer
 
Best answer

 

It's a pretty simple widget. We have something similar for our home page. I've adapted it here to work in the sidebar (I think):
 
<?php
 
class featured_questions {
 
function allow_template($template)
{
return true;
}
function allow_region($region)
{
return ($region=='side');
}
function output_widget($region, $place, $themeobject, $template, $request, $qa_content)
{
global $qa_db;
$query = "select p.postid, p.title, p.userid, p.acount, u.points from qa_posts as p, qa_userpoints as u where p.type = 'Q' and p.userid = u.userid order by p.hotness desc limit 3";
$result = mysql_query($query,$qa_db);
echo '<div class="featured">';
echo '<h2>Featured Questions</h2>';
while($row = mysql_fetch_assoc($result)){
$url = qa_path_html(qa_q_request($row['postid'], $row['title']));
echo '<h4><a href="' . $url . '">' . $row['title'] . '</a></h4>';
echo '<p>Question posted by ' . $row['userid'] . ' <span class="points">(' . $row['points'] . ' points)</span> Answers: ' . $row['acount'] . '</p>';
}
echo '</div>';
 
}
 
};
 
commented Dec 17, 2011 by workremotespain
Hello could you explain where to put this code to make this work? Does it go into the index.php page?  Thanks
commented Jun 13 by phodogo
Thanks You. This is the answer I need
–3 votes
answered Jun 5, 2011 by Aslan
Stil no one who can help me out with this?

I want to list the top 3 hot questions in the sidebar...

I really will be grateful if someone can figure this out.

It's the final thing I want to have on my website. After this I can launch it.
commented Jun 5, 2011 by rajul885
good idea mate
commented Jun 5, 2011 by Aslan
I know! :-P But I don't know how to do that.
–3 votes
answered Jun 7, 2011 by Aslan
Up! There has to be someone who has done this before, right?! :-)
commented Jun 8, 2011 by Scott
Dude, stop bumping and answering your own question! You're more likely to get answers if you left it unanswered.
commented Jun 8, 2011 by Aslan
More likely to get answers if I leave it unanswered? Where do you base that on? Don't you reckon with: bumping  = getting attention to the question = more likelihood of getting an answer.
commented Jun 8, 2011 by Scott
Well my logic was that the question would show up in the Unanswered section. As it is you are adding useless posts, but whatever.
0 votes
answered May 28 by lipsmega
Theres a feed widget. Use it to show hot questions feed.
0 votes
answered Jun 13 by questfor

A bit old question but there's still some people asking how to display popular questions in sidebar.

There's a Q2A plugin for that developed by q2apro. Try it out: q2apro-popular-questions-widget

...