Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 01-22-2005, 12:28 PM
zurih zurih is offline
 
Join Date: Nov 2004
Location: Israel
Posts: 130
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default trying to display a poll in forumhome - need help

I'm trying to display a poll in forumhome for a time now.
What I've done is copy pasting the following code from vBindex index.php into my main index.php:
PHP Code:
// ######################### PROCESS POLL ###############################
if ($vbindex['options'] & VBI_SHOWPOLL) {
// the $pollinfo query here is experimental, to save one query later on I have joined
// the pollvote table if the bbuser is registed, this seems to work fine from my testing
$pollinfo $DB_site->query_first("
## GET POLL ##
SELECT thread.pollid, thread.forumid, open, threadid, replycount, question, poll.dateline,
options, votes, active, numberoptions, timeout, multiple, voters,
pollvote.voteoption, pollvote.userid AS voteuserid
FROM "
.TABLE_PREFIX."thread AS thread
LEFT JOIN "
.TABLE_PREFIX."poll AS poll ON (thread.pollid = poll.pollid)
LEFT JOIN "
.TABLE_PREFIX."deletionlog AS deletionlog ON(thread.threadid = deletionlog.primaryid AND type = 'thread')
LEFT JOIN "
.TABLE_PREFIX."pollvote AS pollvote ON(thread.pollid = pollvote.pollid AND pollvote.userid = $bbuserinfo[userid])
WHERE forumid NOT IN ("
.implode(','$limitfids).")
AND deletionlog.primaryid IS NULL
AND thread.pollid <> 0
AND thread.open <> 10
AND thread.visible = '1'
"
.iif(strtoupper($vbindex['pollsforumid']) != 'ALL'"AND thread.forumid IN ($vbindex[pollsforumid])")."
$globalignore
$ignorelist
ORDER BY "
.iif($vbindex['options'] & VBI_RANDOMPOLL'RAND()''thread.threadid')." DESC
LIMIT 1"
);
if (
$pollinfo['pollid']) {
$pollinfo['question'] = fetch_censored_text($pollinfo['question']);
$splitoptions explode('|||'$pollinfo['options']);
$splitvotes explode('|||'$pollinfo['votes']);
$showresults '';
$uservoted '';
if (!
$pollinfo['active' || !$pollinfo['open'] || ($pollinfo['dateline'] + ($pollinfo['timeout'] * 86400) < TIMENOW && $pollinfo['timeout'])) {
// poll closed
$showresults true;
} elseif (!(
$forumperms["$pollinfo[forumid]"] & CANVOTE)) {
// user cannot vote on this poll
$nopermission true;
} elseif (
fetch_bbarray_cookie('poll_voted'$pollinfo['pollid'])) {
// cookie shows user has voted
$uservoted true;
} elseif (
$bbuserinfo['userid'] == $pollinfo['voteuserid'] && !empty($pollinfo['voteoption'])) {
// pollinfo query shows user has voted
$uservoted true;
}
$i 0;
while(
$i++ < $pollinfo['numberoptions']) {
$pollinfo['numbervotes'] += $splitvotes[$i 1];
}
$i 0;
$option = array();
while(
$i++ < $pollinfo['numberoptions']) {
exec_switch_bg();
$option['question' fetch_censored_text(parse_bbcode($splitoptions[$i 1], $pollinfo['forumid'], $pollinfo['allowsmilies']));
$option['votes'] = $splitvotes[$i 1];
$option['number'] = $i;
if (
$showresults || $uservoted || $nopermission) {
    if (
$showresults) {
     
$status $vbphrase['this_poll_is_closed'];
    } elseif (
$uservoted) {
     
$status $vbphrase['you_have_already_voted_on_this_poll'];
    } elseif (
$nopermission) {
     
$status $vbphrase['you_may_not_vote_on_this_poll'];
    }
    
$percent 0;
    if (
$option['votes']) {
     
$percent vb_number_format($option['votes'] / $pollinfo['numbervotes'] * 1002);
    }
    
$option['graphicnumber'] = $option['number'] % 1;
    
$option['barnumber'] = round($percent) * 1.3;
    
$showform false;
    eval(
"\$home[pollbits] .= \"".fetch_template('vbindex_poll_result')."\";");
} elseif (
$pollinfo['multiple']) {
    
// mutiple choice poll
    
$multiple true;
    
$showform true;
    eval(
"\$home[pollbits] .= \"".fetch_template('vbindex_poll_option')."\";");
} else {
    
// single choice poll
    
$multiple false;
    
$showform true;
    eval(
"\$home[pollbits] .= \"".fetch_template('vbindex_poll_option')."\";");
}
}
eval(
"\$side[poll] = \"".fetch_template('vbindex_poll')."\";");
}

I copied the globaltemplates arrayes, and created the necessary template.
in forumhome I put $pollbits.
the thing is that I dont know excatly what I have to change in the php code to remove vBindex installation dependance. So I need some help on that.

Right now - nothing is displayed in my forumhome.
any help would be appreciated.
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:13 PM.


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.03549 seconds
  • Memory Usage 2,353KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (2)post_thanks_box
  • (2)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit_info
  • (2)postbit
  • (2)postbit_onlinestatus
  • (2)postbit_wrapper
  • (1)showthread_list
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_threadedmode.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids_threaded
  • showthread_threaded_construct_link
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete