Log in

View Full Version : Coding Problems


Twilkey
06-12-2008, 05:21 PM
I am having a couple problems.

1. How do I get this code to loop more then once. As it is now, it only displays 1 entry and I dont know why.
//Display The News
$newsquery = $vbulletin->db->query_read("SELECT * FROM " . TABLE_PREFIX . "home_news");
while ($news = $vbulletin->db->fetch_array($newsquery))
{
$newstitle = htmlspecialchars_uni($news['newstitle']);
$newstext = htmlspecialchars_uni($news['message']);
$tid = $news['threadnum'];
eval('$home_newslist = "' . fetch_template('home_newslist') . '";');
}
eval('$home_news = "' . fetch_template('home_news') . '";');

2. How do you pull the latest poll from a certain forum and display it on a custom vB page.

Guest190829
06-12-2008, 05:46 PM
You need to concat the $home_newslist with .=:

eval('$home_newslist .= "' . fetch_template('home_newslist') . '";');

Twilkey
06-12-2008, 06:43 PM
You need to concat the $home_newslist with .=:

eval('$home_newslist .= "' . fetch_template('home_newslist') . '";');

Thanks that worked. Now for an answer to the 2nd question.

Opserty
06-12-2008, 09:54 PM
Select the last thread from the forum where the pollid does not equal 0.
So

WHERE forumid = X AND pollid != 0


You'd then need too pull the poll information from the poll table, maybe with a join statement?

Best would be to set up a test poll and see what is going on.