vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Member Archives (https://vborg.vbsupport.ru/forumdisplay.php?f=202)
-   -   Working on link to polls on non-vb page, need help (https://vborg.vbsupport.ru/showthread.php?t=18386)

Mitrofan 05-27-2001 08:30 PM

I made a small hack that puts a X number of links to latest polls in the forum.
It could be forther fine tuned to specify which forums to include, in my case I need the latest polls from all forums.

It can be used on non-VB page like home page.

Here is tha code.<?
require("forums/admin/config.php");
$db=mysql_connect($servername,$dbusername,$dbpassw ord);
mysql_select_db($dbname);
$mypollselect = "select threadid, title, pollid, lastpost, replycount, views FROM thread where pollid!=0 ORDER BY lastpost DESC LIMIT 5";
$pollresult = mysql_query($mypollselect);

if ($row = mysql_fetch_array($pollresult)) {
do {
printf("<br><FONT FACE=\"Verdana, Arial, Helvetica, sans-serif\" SIZE=\"1\"><a href=\"http://www.yoururl.com/forums/showthread.php?threadid=%d\"><b>%s</b></a><br><FONT FACE=\"Verdana, Arial, Helvetica, sans-serif\" SIZE=\"1\">&nbsp;&nbsp;&nbsp;%d views - %d replies</font>", $row[threadid], $row[title], $row[views], $row[replycount]);
} while ($row = mysql_fetch_array($pollresult));
}
?>

It shows links to latest 5 polls with number of replies and number of views.

I want to add the number of votes also, but just don't know how to do that.

I think I know how to add the number of votes when I only put a link to one latest poll, but don't know how to do the same with the list of X number of polls.

Please someone help me. It should be easy for any php programmer, which I am not.


All times are GMT. The time now is 11:49 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01167 seconds
  • Memory Usage 1,704KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (1)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete