View Full Version : Polls Elsewhere

12 Apr 2001, 18:25
v0.2.0 Released! Last Updated: 06/01/01

NOTE: DO NOT put this in your forums directory or it WILL overwrite your poll.php file! You must either a) put this in a separate directory or b) rename this to poll1.php or something similar (the script will still function correctly if you do this).

This hack is a request by Me2Be, to show the titles of the poll threads on another page. It uses the header and footer from your vB, and is for use as a stand-alone page. In a future release of the hack, I will look into displaying results of the polls also. For right now, though, it just displays the thread title, linked to that thread, and the forum that the thread is in (they are grouped by forum). You can set the forums to look for polls in, as well as how many polls you want to show on the main screen. There is a separate screen that will show all of the poll threads from any given forum, and a link to this screen is generated any time there are more threads than you want displayed. You can also customize it so you can use it as a separate page, or remove the HTML to use it as an include on another page (it is clearly labeled where to insert HTML).

For version: 2.0.0

Files needed: poll.php, pollconfig.php

Files to edit: pollconfig.php

1] Download the zip file, and unzip it somewhere on your hard drive. Open pollconfig.php in an ASCII text editor, such as TextPad, UltraEdit, EditPlus, Notepad, Wordpad, or a similar program. DO NOT use a program such as HotDog, HoTMeTaL, FrontPage, or another WYSIWYG editor. I cannot support you if you open your file in one of these programs.
2] You need to edit the following variables:

$path - the path to your config.php, relative to where you are putting pollconfig.php. So, if your config.php file is in /home/me/html/forums/admin and you are putting this file in /home/me/html/ then the path is forums/admin - no trailing slash, and no "config.php".
$url - the URL to your forums. For example, http://www.mysite.com/forums - no trailing slash, no whateverfile.php.
$images - the URL to your forum images. For example, http://www.mysite.com/forums/images - no trailing slash, no whatever.gif.
$forums - the forum numbers to use, separated by a comma. You can find out the number of a forum by going to your forums' index.php and running your mouse over the link to the forum(s) you want to include. Make a note of "xx" in forumid=xx where xx is a number (this will appear in the status bar of your browser).
$maxresults - the maximum results to show on the main page for each forum. If you set this to 3, for example, and there are 5 polls in a given forum, the script will generate a "more polls for this forum" link, which will link to a page with all the polls for that forum listed.
$id - the ID of the replacement set you want to use. If you have a custom set, put that ID here. If you leave this blank it will use the style named "Default" that comes with vB.
3] Save this file.
4] Upload poll.php and pollconfig.php to your server. DO NOT UPLOAD the files to your vB directory! Doing so will overwrite the vB poll.php which will mean no one will be able to post new polls! Go to poll.php in a browser to make sure it is working correctly. Then you can link to it from another page, or from your forums.

Please do not contact me via ICQ, AIM, or PM about this hack. Post your question/problem here and I will see it and try to help you.


12 Apr 2001, 18:30
Thank you! Thank you!!

Actually, I didn't want the poll results on the page, so this is great. I'm off to try it now!

BTW, the demo link goes to a 404 page :)

12 Apr 2001, 18:33
Whoops! You're right. Gotta fix that. edit: fixed :D

You're welcome. ;)

12 Apr 2001, 18:41
Well, I replaced the poll.php and the pollconfig.php and uploaded it. When I go to test the poll.php file and put in my subject, message, check poll and enter how many options, it goes the the redirect screen and then back to the forumdisplay again.

It never went to ask me for poll options, and it also put my thread in the moderator queue (which is normal if someone creates a post, clicks poll and doesn't provide any options)

12 Apr 2001, 18:43
Originally posted by tubedogg
Whoops! You're right. Gotta fix that. edit: fixed :DClose, just change it to poll.php instead of polls.php

But it looks great!!!

Is there a way to add the forum header/footer/styles?

(Aren't I full of questions?) :D

12 Apr 2001, 18:45
The Demo has still a 404 Error.

12 Apr 2001, 18:46
Wait no no no! :D I'm sorry, don't replace poll.php - this is totally separate from that. I should have made that more clear. This is for elsewhere on one's site. Sorry...you need to reupload poll.php from beta 5 to your forums directory, and put poll.php from my hack in a separate directory, or rename it to poll1.php or something like that.

Streicher: Yes you're right. It is now really fixed. ;)

12 Apr 2001, 18:50
Hmm...give me a little bit and I'll try to work in the header/footer styles.

12 Apr 2001, 18:54
Nice one thx :)

12 Apr 2001, 19:04
Originally posted by tubedogg
Wait no no no! :D I'm sorry, don't replace poll.php - this is totally separate from that. I should have made that more clear. Oops! Thank GOODNESS I saved the other copy

(I backup everything when I make changes!)

I'm still on beta 2 (until next week when 6 comes out), I wonder if it will still work.

*off to try it*

Freddie Bingham
12 Apr 2001, 19:10
I'm still on beta 2 (until next week when 6 comes out), I wonder if it will still work. Hopefully there will not be a beta 6.

12 Apr 2001, 20:13
Originally posted by freddie
Hopefully there will not be a beta 6.

Does this mean, we're shooting for full "production" by next week?????? :D :D :D

12 Apr 2001, 20:16
Originally posted by freddie
Hopefully there will not be a beta 6.

me too erf,want a stable release :rolleyes:

12 Apr 2001, 20:20
Originally posted by RobAC
Does this mean, we're shooting for full "production" by next week?????? :D :D :D

I doubt it. ;) We got to get through a Release Candidate first, at least according to what's been said elsewhere around here. :)

13 Apr 2001, 16:16
Originally posted by tubedogg
Hmm...give me a little bit and I'll try to work in the header/footer styles. Thanks Kevin!!!

I can't wait to go live with this :)

13 Apr 2001, 22:52
After much hair-pulling and screaming at the monitor, I have completed the changes mentioned by Me2Be (adding the board's header and footer). You can take a look at the demo to see how it works.


14 Apr 2001, 00:32
Where's the demo?? :D

14 Apr 2001, 01:36
Originally posted by RobAC
Where's the demo?? :D

Demo: http://www.tubescan.com/poll.php
at the very firt page!!

14 Apr 2001, 19:51
Oh I am SOOOO happy! :D

**off to try it!!! **


14 Apr 2001, 20:03
You're welcome, Me2Be. ;)

Rob: Sorry I should have pointed that out. :D

One more thing I should point out: This will work with any beta from 2 through 5 (and probably 1, also). I said beta 5, but then I realized I was testing it with beta 2, not beta 5 (long story...) and so it does work with beta 2, and therefore should work with 1, and will work with 3 and 4.

14 Apr 2001, 20:18
wow nice... might need to upgrade to beta 5 for this :)

14 Apr 2001, 20:42
It works with betas 2-4 also, George. ;)

14 Apr 2001, 20:45
ne chance of a hack that puts a poll on ya main page like emm... the optims like a radio button. you know like the ones on sites well ne way. is it possible.

14 Apr 2001, 20:59
I made a few "asthetic" modifications, but it works great!!! I'll send you the URL so you can check it out.

Also, I renamed your poll.php file to polllist.php so I could put it in the main directory and it works great!!!

If you ever decide to "enhance" upon this, can I throw out a couple more suggestions? (I'm saying "enhance" because it works great now!)

1] Ability to put the info HTML into a template so we can add some commentary (like "My Poll List") and a <title>Title</title>

2] Ability to use color styles of the style choice

Kevin, you did an awesome job and I can't thank you enough!!!! I love it!!

14 Apr 2001, 21:04
Originally posted by tubedogg
It works with betas 2-4 also, George. ;) great but i might wait until i upgrade to beta 5...

don't know why , but i feel like waiting for beta 6 or something...

24 Apr 2001, 01:05
Perfect, it is just I was looking for! :)
Thanks tubedogg.
In poll.php it seems there is not the close </ul> at the end of line 97.

It would be very nice to show the date the poll started, so people can know if they have already visited that poll or not. :)

10 May 2001, 12:31
Does this hack work with RC2?

10 May 2001, 12:41

10 May 2001, 12:56
Muchas gracias :)

18 May 2001, 14:03
It seems that phpinclude stuff is not processed in header and footer when this hack is displayed.

I have $thefooter defined in phpinclude and with this hack is just displas $thefooter where the footer is supposed to be

Also Powered by: vBulletin $templateversion
is shown just like that, so the $templateversion variable is also not processed.

There must be a simple fix , please look into that.

Kevin, please respond to this post.

18 May 2001, 22:49
Is it possible to make a hack, which displays the results of a vote with the colored bars on a non vB page?

21 May 2001, 20:08

tubedogg, please respond to my previous post of phpinclude not working with this hack.

I really want to use this hack, but can't without phpinclude stuff working.

24 May 2001, 11:06
Originally posted by Streicher
Is it possible to make a hack, which displays the results of a vote with the colored bars on a non vB page?

Thats what Ive been after for a while if you or anyone get their hands on anything like it be sure to gives us a bell and let me know, and i'll do likewise.

25 May 2001, 19:43
I'm having a problem with this script now that eventhough I se the maxresults to 5 or what have you in the config, the script is still pulling every single poll out.

01 Jun 2001, 22:17
v0.2.0 has been released, and is updated to ensure it works with vBulletin 2.0.0. It also now includes the phpinclude template.

01 Jun 2001, 23:48
Parse error: parse error in /usr/local/plesk/apache/vhosts/myhost.com/httpdocs/forum/pollist.php on line 105

03 Jun 2001, 02:04
I am getting the same exact error...

03 Jun 2001, 02:21
I have updated the first post in this thread with v0.2.1 which fixes the parse error and this time actually utilizes the phpinclude template as opposed to just echoing it to the page. :rolleyes:

03 Jun 2001, 02:27
Now I am getting blank pages

03 Jun 2001, 02:33
Try deleting poll.php and pollconfig.php off your server and reuploading them.

03 Jun 2001, 02:35
I did, still no luck...

03 Jun 2001, 02:40
Is there anything in your phpinclude template?

03 Jun 2001, 02:42
No, Its empty

03 Jun 2001, 02:44
You got a URL to where you've installed this?

03 Jun 2001, 02:48

03 Jun 2001, 02:52
OK dumb question time. Did you upload pollconfig.php? Did you set the path to your admin/config.php file correctly?

Try adding
<!-- This is a test comment -->
right after
and see if it shows up on the page.

03 Jun 2001, 02:55
look at it now..., can you icq me? 107230003

03 Jun 2001, 03:00
Sorry, I don't support hacks via ICQ.

That was my mistake - put this instead:

echo("<!-- This is a test comment -->");

right after


03 Jun 2001, 03:02
I added that, I just wanted to add you to my icq list...

03 Jun 2001, 03:13
Try removing


from poll.php and see if that helps.

03 Jun 2001, 03:18
Okay, now the comment is working, but not the polls... check it out...

03 Jun 2001, 03:18
did you upload in ascii mode ?

it worked for me

03 Jun 2001, 03:19
I dont have to upload, just copy... My server is on my LAN...

03 Jun 2001, 03:28
I'm at a loss, Josh. It works perfectly for me, and there's no reason it shouldn't just be not working, especially with no error messages.

03 Jun 2001, 03:30
here is my pollconfig.php

03 Jun 2001, 03:32
Ok my next question is are you positive that path would work?

Maybe try setting it as

03 Jun 2001, 03:36
I have it working for online.php...

Here is what I have:

Drive E > Sites folder
Forums & tech

06 Jun 2001, 21:21
Tubedogg, I want to ask you a weird question.

Is there any way you can add this in your script...

I like how it pulls the title of the polls, but is there any way you can get the first one to display the radio buttons, the option, and the 'vote' button where they can vote with this script?

For example, I would include the script on my main page and people would vote from there, and once they did, they would be directed to the poll in the forums.

What do you think? Can it be done? ;)

06 Jun 2001, 21:25
im waiting for that as well he does have it on his site though.

08 Jun 2001, 05:09
Of course, I get an error...

Fatal error: Call to unsupported or undefined function foreach() in /../..../.../pollpage.php3 on line 85

Any ideas?


08 Jun 2001, 05:15
First I'm positive that
is not a valid path.
Also PHP 3 does not support foreach(). I'll probably look into some way around this but for now there's not much I can do. Sorry.

08 Jun 2001, 05:22
Thanks tubedogg,

Have you figured out the parse error problem with who's online hack yet? You thought that it might be a php3 problem as well...


15 Jun 2001, 18:25
By reading the description I am not sure whether this hack allows me to conduct a survey or not.

A survey requires that I display several questions in a page, and below each question several possible answers are displayed.
User clicks submit after selecting one of the possible answers for all questions.
The hack should now propogate users answers to individual polls in vB.

Does this or any other hack for vB supports this? Or there any php/mysql based scripts that do this (even if they are not integrated with vB)?

-- Annam

17 Jun 2001, 15:53

Many users of the vB seem to ask about poll radio buttons inclusion on their non vB pages with the ability to vote from there. This would be a great tool for all site administrators to pull visitors from their sites into their forums, stick and carrot stylie
But one thing seems to be missing - your reply to these. ;)
Is this deliberate?

tubescan.com still powered by vBulletin Version 2.0.0 Beta 3

21 Jun 2001, 05:52
Okay I need some help... I went to install this hack and found I had a problem.

On my server's "e" drive there is a sites directory. In there are all of my sites, two being my main site and forums. In the poll configuration for the $path variable to the forums/admin/config.php, it doesnt seem to like me entering e:/sites/forums/admin. I dont know what to do and would like to get this working for my new sites launch possibly tomorrow!


21 Jun 2001, 10:50
Originally posted by surfdude
Many users of the vB seem to ask about poll radio buttons inclusion on their non vB pages with the ability to vote from there. This would be a great tool for all site administrators to pull visitors from their sites into their forums, stick and carrot stylie
But one thing seems to be missing - your reply to these. ;)
Is this deliberate?I thought I had answered this a ways up but this hack doesn't do that at this point and probably won't at least for a while. I really don't have the time to write it now.

tubescan.com still powered by vBulletin Version 2.0.0 Beta 3Your point?

21 Jun 2001, 10:51
Josh: My experience with Windows servers could be fit into a 1x1 graphic. I have no idea about how stuff like that works and am not really sure what to tell you. Maybe someone else here with experience on Win servers could help him out?

21 Jun 2001, 14:17
Okay, thanks!

28 Jun 2001, 17:08
Kevin is there an easy way just to include a bulleted list of polls without links to the relevant forums or click here for more polls?

Sorry :)

29 Jun 2001, 00:34
I've managed to get this to just show the latest polls (no forum links) but it doesn't seem to be showing the latest polls


There are definately polls posted after that date and I have included the correct forum ID's :(

10 Jul 2001, 15:18
I am getting this error..
Fatal error: Failed opening required 'home/sites/20ishparents.com/web/boards/admin/config.php' (include_path='.:/usr/local/lib/php') in
/home/sites/20ishparents.com/web/boards/poll1.php on line 11

which I am sure is a path error even though my path is correct. I guess what I am asking is what does this mean? (include_path='.:/usr/local/lib/php')
I apprecaite any help!

22 Aug 2001, 18:41
How can I put Title and keywords metatags in poll.php?

22 Aug 2001, 21:14
I want to be able to have the poll question and voting options on the same page (non vB). When you submit a vote, it takes you to the results/thread page. Is this possible?

17 Sep 2001, 21:14
I am looking for something SIMILAR to this.

I would like to pull the entire poll questions and choices on another page (nested, like on your home page somewhere) with the ability to cast your vote. After you cast your vote, it takes you to the vB page where that current poll is to view the results and talk about the poll.

12 Oct 2001, 23:34

did you get anywhere on this? i'm also looking for a hack to let me put embedded VB polls on my homepage. i've currently got my own poll sw (non-VB, using perl and flat-files) running to do it but it's a pain to maintain and an integrate system would be so much cooler.



13 Oct 2001, 01:54
Sorta. The only thing I came up with was vbPortal (phpportals.com)

vbPortal sits on top of vBulletin.

13 Oct 2001, 04:55
have you managed to isolate the code from vbportal to just implement the poll?

i'm about half way thru figuring out some rough mySQL code to hard code a VB poll. it's not going to be idiot proof so still would like to know if anyone else is working on something better.



17 Jun 2002, 23:09
I'm sure I asked this before but would it be possible for someone to post the code that would select the last X polls from a list of forums and display them chronologically regardless of forum?



13 May 2003, 03:39
How can I get a link to the results page of a particular poll? I want my poll.php to display:

Poll title

Vote Now
View Results
Past Polls

I have everything working but View Results.