View Single Post
  #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
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01187 seconds
  • Memory Usage 1,840KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.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_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • 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
  • showpost_complete