TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
Stats
  • Total Posts: 195,994
  • Total Topics: 21,325
  • Online today: 777
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 126
  • Total: 126

How to feature a forum poll in TP?

Started by misjka, January 05, 2006, 06:26:03 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

misjka

Hi!
I wonder how to feature a single forum poll (or several single polls, or posts for that matter?) on the frontpage of TP?

Rasyr

If you pull up the ssi_examples.php file that is in the root of the forums, there are already several functions built that will display a poll.

However, these functions do not give you control over which poll to display, and they do not show the results of the poll once the user has voted.

I have already asked about being able to show polls on the front page as well. :)

8

misjka

Thanks - great :D!

Well, what about <?php ssi_showPoll($topic); ?> that shows up on that page ??? And how do I implement that code, if the correct one?, into a self made block?

gerrymo

To use the code you have, put it into a php block, but leave out the php tags.


ssi_showPoll($topic);

misjka

Thanks, that seemed to work... but I only got the poll result, not the voting form itself (I haven't voted in that poll myself)... Instead of the $topic string I just wrote the number of the topic, ssi_showPoll(684.0);
that is... Right or wrong...?

Rasyr

Wow, I must of messed something up the other day when I was trying it.. hehe

I only ever saw the poll questions, never the results.

However, I just tried it again, and it works very well. Although, it did break the column format (I had the poll in the right hand column), so I changed a couple of things in the ssi.php file to shorten the results bar. Around line 950, you will find a line that reads:
$barWide = $bar == 0 ? 1 : floor(($bar * 5) / 3);
I changed it to:
$barWide = $bar == 0 ? 1 : floor(($bar * 5) / 6);

And down around line 1000, I changed
<tr>
<td align="left" valign="top"><b>', $option['option'], '</b></td>
<td align="left">', $option['bar'], ' ', $option['votes'], '(', $option['percent'], '%)</td>
</tr>';


to

<tr>
<td align="left" valign="top"><b>', $option['option'], '</b></td>
</tr><tr>
<td align="left">', $option['bar'], ' ', $option['votes'], '(', $option['percent'], '%)</td>
</tr>';

misjka

Do you mean you could see the question as well as the result from the poll??? Over here I only see the result... Do you have an url to give me to check what it looks like over yours, before I get into that hacking php business and probably screw things up :uglystupid2: ?

Rasyr

Yes, I saw the poll until I voted and then saw the results.

I did it on a test installation on a local machine, so I cannot give you a URL (I am waiting on ver 0.8 before installing it on a live site, as I am also planning on upgrading to 1.1 RC2 at the same time...).

However, I did take a few screen shots of it that I can show you. Also, as a suggestion, instead of changing the function itself, it might be a better idea to copy it, and paste that copy at the bottom of the file (before the ?> that closes the file), and then just give it a slightly different name, and then make the changes I suggested in the new function.



               

misjka

#8
Sry, the attachments didn't work over here but I may go ahead with the code changes anyway :D. Thanks!

EDIT: Well, I still just see the result from the poll - even when I'm logged out  :tickedoff:... I wonder, may this be a 1.0.5 issue, or did I use the wrong code for that $topic argument to the function...???

misjka

Sure, the code change worked allright  ;D! Thanks!
But, still 2 issues:

1) As before, I just can see the poll result  :-\
2) The text font in the poll result is too big, overflooding the block.... Where may I change that (am using the default theme, btw)...?

This website is proudly hosted on Crocweb Cloud Website Hosting.