Help
skylar 0
From: -
From: -
Notice
This topic is archived. New comments cannot be posted and votes cannot be cast.Responses to this topic
1 Re: Help
Philipp
From: Vienna, Austria
Administrator
1340From: Vienna, Austria
Help
No, not without some heavy modifications. However, anonymous votes are included in the upcoming version 2.0
No, not without some heavy modifications. However, anonymous votes are included in the upcoming version 2.0
1 Re: Help
Forma 17
From: -
From: -
Help
I’ve just noticed you can only vote in the poll if you are a registered user. Is it possible to change this so that anyone can vote?
I’ve just noticed you can only vote in the poll if you are a registered user. Is it possible to change this so that anyone can vote?
1 Re: Help
Forma 17
From: -
From: -
Help
Thanks very much, hope i'm not bothering you with all my questions of late (probably am).
Thanks very much, hope i'm not bothering you with all my questions of late (probably am).
1 Re: Help
Philipp
From: Vienna, Austria
Administrator
1340From: Vienna, Austria
Help
// Show last poll in site_header
dbconnect();
$query = DBQuery("SELECT * FROM esselbach_st_polls ORDER BY poll_id DESC");
$polldata = mysql_fetch_array($query);
$pollbox = "<b>$polldata[poll_title]</b><br /><br />";
$user = explode(":",base64_decode($_COOKIE[esselbachst]));
$username = checkvar($user[0]);
$query = DBQuery("SELECT * FROM esselbach_st_pollusers WHERE polluser_poll = '$polldata[poll_id]' AND polluser_user = '$username'");
if (mysql_num_rows($query))
{
for($y = 1; $y < 13; $y++) {
if ($polldata['poll_option'.$y]) {
$percent = 100 * $polldata['poll_vote'.$y] / $polldata[poll_votes];
$option = $polldata['poll_option'.$y];
$votes = $polldata['poll_vote'.$y];
$percent = round($percent);
$votebar = $percent * 2 / 2;
$allvotes = $allvotes + $votes;
$pollbox .= "$option ($percent% / $votes votes)<br /><img src="https://www.contentteller.com/images/votebar.png" width="$votebar" height="9" alt="" /><br /><br />";
}
}
$pollbox .= "Total Votes: $allvotes<br />";
} else {
for($y = 1; $y < 13; $y++) {
if ($polldata['poll_option'.$y]) {
$percent = 100 * $polldata['poll_vote'.$y] / $polldata[poll_votes];
$option = $polldata['poll_option'.$y];
$votes = $polldata['poll_vote'.$y];
$percent = round($percent);
$pollbox .= "<input type=radio name=vote value=$y>$option<br />";
}
}
$pollbox .= "<br /><input type=hidden name=poll value=$polldata[poll_id]><input type=submit value=Vote>";
}
1 Re: Help
Forma 17
From: -
From: -
Help
just what i was after, only the graphic bars are not in the example you gave and i don't know what to do to make them appear, could you modify it to do this please
Oh, and a "total votes:" bit would be really cool.
Thanks
Ps. I want to use this code
on poll_done instead of a link to index.php, only because it doesn't refesh the page it doesn't update the poll. Is there a way to use this and refresh the page?
[Edited by forma on 2005-09-04 21:16:25]
[Edited by forma on 2005-09-04 21:17:24]
just what i was after, only the graphic bars are not in the example you gave and i don't know what to do to make them appear, could you modify it to do this please
Oh, and a "total votes:" bit would be really cool.
Thanks
Ps. I want to use this code
<a href="https://www.contentteller.com/javascript:history.go(-1)">Back to previous page</a>
on poll_done instead of a link to index.php, only because it doesn't refesh the page it doesn't update the poll. Is there a way to use this and refresh the page?
[Edited by forma on 2005-09-04 21:16:25]
[Edited by forma on 2005-09-04 21:17:24]
1 Re: Help
Rushian 0
From: -
From: -
Help
Originally posted by Philipp:
FYI: Make sure you put the $pollbox var into a <form> in your template or else clicking [Vote] won't do anything.
This is not true. I figured out how to tweak the headlines templates to put *any* code you want into any of the headlines blocks. It's actually quite trivial. Here's how you do it:
1) Edit main_block_file to this:
2) Now, under the website section in the admin CP, you configure the blocks. Make the title anythig you want. Select "Use custom block file" for "Block #x", and you must create a custom block named whatever you want, and enter that name in the "Block file for Block #x". The block file containts the keyword that the main_block_file template looks for.
So, in my example above, the poll.block file contains ONLY the word poll (no whitespace or linefeeds). When the template 'runs', the custom block I specified in the Websites section will match the "poll" keyword, and therefore run my custom pollcode.php script.
The same thing happens for my recon_pic.block, except that time it will run my custom recon_pic.php script and return the results into the headline block.
You'll have to expand/change the template to suit your script names and keywords. Make sure the output of your script is returned in the $this_block var.
It's tricky to explain, but works like a charm. And lol, when all is said and done, I decided to keep the poll in the left menu, and put the last 10 forum topics in the right headlines block, but at least I figured out how to put any code into any headline block. 8) As far as I can tell, the cache doesn't have any effect on it. "Works for me!"
Originally posted by Philipp:
Originally posted by Rushian:
Additionally, if the person has already voted, I'd like the 'results' page displayed, not just the 'vote' page.. Can that be done too?
Here the updated code:
// Show last poll in site_header
dbconnect();
$query = DBQuery("SELECT * FROM esselbach_st_polls ORDER BY poll_id DESC");
$polldata = mysql_fetch_array($query);
$pollbox = "<b>$polldata[poll_title]</b><br /><br />";
$user = explode(":",base64_decode($_COOKIE[esselbachst]));
$username = checkvar($user[0]);
$query = DBQuery("SELECT * FROM esselbach_st_pollusers WHERE polluser_poll = '$polldata[poll_id]' AND polluser_user = '$username'");
if (mysql_num_rows($query))
{
for($y = 1; $y < 13; $y++) {
if ($polldata['poll_option'.$y]) {
$percent = 100 * $polldata['poll_vote'.$y] / $polldata[poll_votes];
$option = $polldata['poll_option'.$y];
$votes = $polldata['poll_vote'.$y];
$percent = round($percent);
$pollbox .= "$option ($percent% / $votes votes)<br />";
}
}
$pollbox .= "<br />";
} else {
for($y = 1; $y < 13; $y++) {
if ($polldata['poll_option'.$y]) {
$percent = 100 * $polldata['poll_vote'.$y] / $polldata[poll_votes];
$option = $polldata['poll_option'.$y];
$votes = $polldata['poll_vote'.$y];
$percent = round($percent);
$pollbox .= "<input type=radio name=vote value=$y>$option<br />";
}
}
$pollbox .= "<br /><input type=hidden name=poll value=$polldata[poll_id]><input type=submit value=Vote>";
}
FYI: Make sure you put the $pollbox var into a <form> in your template or else clicking [Vote] won't do anything.
Originally posted by Rushian:
This is what I need, but I'd liike to display the poll in the right newsblock header.
This is not possible without heavy modifications because of the caching system. Only the site_header and site_footer templates are created dynamic and without the caching system.
This is not true. I figured out how to tweak the headlines templates to put *any* code you want into any of the headlines blocks. It's actually quite trivial. Here's how you do it:
1) Edit main_block_file to this:
<?php
global $insert;
// get current .block file
if ($insert[story_blockline] == "recon")
{
include("scripts/recon_pic.php");
}
if ($insert[story_blockline] == "poll")
{
include("scripts/pollcode.php");
$this_block = $pollbox;
}
$EST_TEMPLATE = <<<TEMPLATE
<!-- Template main_block_file -->
$this_block
TEMPLATE;
?>
2) Now, under the website section in the admin CP, you configure the blocks. Make the title anythig you want. Select "Use custom block file" for "Block #x", and you must create a custom block named whatever you want, and enter that name in the "Block file for Block #x". The block file containts the keyword that the main_block_file template looks for.
So, in my example above, the poll.block file contains ONLY the word poll (no whitespace or linefeeds). When the template 'runs', the custom block I specified in the Websites section will match the "poll" keyword, and therefore run my custom pollcode.php script.
The same thing happens for my recon_pic.block, except that time it will run my custom recon_pic.php script and return the results into the headline block.
You'll have to expand/change the template to suit your script names and keywords. Make sure the output of your script is returned in the $this_block var.
It's tricky to explain, but works like a charm. And lol, when all is said and done, I decided to keep the poll in the left menu, and put the last 10 forum topics in the right headlines block, but at least I figured out how to put any code into any headline block. 8) As far as I can tell, the cache doesn't have any effect on it. "Works for me!"
1 Re: Help
Philipp
From: Vienna, Austria
Administrator
1340From: Vienna, Austria
Help
Originally posted by Rushian:
Here the updated code:
Originally posted by Rushian:
This is not possible without heavy modifications because of the caching system. Only the site_header and site_footer templates are created dynamic and without the caching system.
Originally posted by Rushian:
Additionally, if the person has already voted, I'd like the 'results' page displayed, not just the 'vote' page.. Can that be done too?
Here the updated code:
// Show last poll in site_header
dbconnect();
$query = DBQuery("SELECT * FROM esselbach_st_polls ORDER BY poll_id DESC");
$polldata = mysql_fetch_array($query);
$pollbox = "<b>$polldata[poll_title]</b><br /><br />";
$user = explode(":",base64_decode($_COOKIE[esselbachst]));
$username = checkvar($user[0]);
$query = DBQuery("SELECT * FROM esselbach_st_pollusers WHERE polluser_poll = '$polldata[poll_id]' AND polluser_user = '$username'");
if (mysql_num_rows($query))
{
for($y = 1; $y < 13; $y++) {
if ($polldata['poll_option'.$y]) {
$percent = 100 * $polldata['poll_vote'.$y] / $polldata[poll_votes];
$option = $polldata['poll_option'.$y];
$votes = $polldata['poll_vote'.$y];
$percent = round($percent);
$pollbox .= "$option ($percent% / $votes votes)<br />";
}
}
$pollbox .= "<br />";
} else {
for($y = 1; $y < 13; $y++) {
if ($polldata['poll_option'.$y]) {
$percent = 100 * $polldata['poll_vote'.$y] / $polldata[poll_votes];
$option = $polldata['poll_option'.$y];
$votes = $polldata['poll_vote'.$y];
$percent = round($percent);
$pollbox .= "<input type=radio name=vote value=$y>$option<br />";
}
}
$pollbox .= "<br /><input type=hidden name=poll value=$polldata[poll_id]><input type=submit value=Vote>";
}
Originally posted by Rushian:
This is what I need, but I'd liike to display the poll in the right newsblock header.
This is not possible without heavy modifications because of the caching system. Only the site_header and site_footer templates are created dynamic and without the caching system.
1 Re: Help
Rushian 0
From: -
From: -
Help
Additionally, if the person has already voted, I'd like the 'results' page displayed, not just the 'vote' page.. Can that be done too?
Additionally, if the person has already voted, I'd like the 'results' page displayed, not just the 'vote' page.. Can that be done too?
1 Re: Help
Rushian 0
From: -
From: -
Help
This is what I need, but I'd liike to display the poll in the right newsblock header.
I made a custom block named poll.block, but it doesn't quite do what I want..
Instead of adding the middle part (// show last poll in site header), I added it to the main_block_middle template instead, but when I view my main page, the poll doesn't 'run', it just prints "$pollbox [button] Details" (and is also part of a bulleted list; I probably shouldn't be using the HTML in a custom block code I guess.. it seems to be only for linked items..?)
If I add the last HTML part to the main_block_middle template, the poll does 'run', but also displays in the news headlines block as well. (but curiously, not the 'latest forum topics" section.)
I'm close, but it's not quite the way I want it set up (ie. 'running' the poll in the right newsblock section). Is there a way that anyone can think of? The closest way that I can think of is if I can conditionally test which block I'm in in the main_block_middle template.)
Any help greatly appreciated.
This is what I need, but I'd liike to display the poll in the right newsblock header.
I made a custom block named poll.block, but it doesn't quite do what I want..
Instead of adding the middle part (// show last poll in site header), I added it to the main_block_middle template instead, but when I view my main page, the poll doesn't 'run', it just prints "$pollbox [button] Details" (and is also part of a bulleted list; I probably shouldn't be using the HTML in a custom block code I guess.. it seems to be only for linked items..?)
If I add the last HTML part to the main_block_middle template, the poll does 'run', but also displays in the news headlines block as well. (but curiously, not the 'latest forum topics" section.)
I'm close, but it's not quite the way I want it set up (ie. 'running' the poll in the right newsblock section). Is there a way that anyone can think of? The closest way that I can think of is if I can conditionally test which block I'm in in the main_block_middle template.)
Any help greatly appreciated.
1 Re: Help
Philipp
From: Vienna, Austria
Administrator
1340From: Vienna, Austria
Help
Open site_header in an editor and add after:
the following code:
Here an example poll block:
You need to add the second code in the HTML part of the template where the poll block should appear.
I hope everything is clear. Let me know if you have any questions.
Open site_header in an editor and add after:
<?php
global $insert;
the following code:
// Show last poll in site_header
dbconnect();
$query = DBQuery("SELECT * FROM esselbach_st_polls ORDER BY poll_id DESC");
$polldata = mysql_fetch_array($query);
$pollbox = "<b>$polldata[poll_title]</b><br /><br />";
for($y = 1; $y < 13; $y++) {
if ($polldata['poll_option'.$y]) {
$percent = 100 * $polldata['poll_vote'.$y] / $polldata[poll_votes];
$option = $polldata['poll_option'.$y];
$votes = $polldata['poll_vote'.$y];
$percent = round($percent);
$pollbox .= "<input type=radio name=vote value=$y>$option<br /><small>($percent% / $votes votes)<br /></small><br />";
}
}
Here an example poll block:
<table cellspacing="0" cellpadding="0" width="160" bgcolor="#000000" border="0">
<tr>
<td>
<table cellspacing="1" cellpadding="3" width="100%" border="0">
<tr>
<td bgcolor="#75a9d9">
<font face="Verdana, Arial, sans-serif" color="#ffffff" size="2"><b>Poll</b></font></td>
</tr>
<tr>
<td bgcolor="#ffffff"><font size="2">
<form action="poll.php" method="post">
$pollbox
<input type="hidden" name="poll" value="$polldata[poll_id]">
<input type="submit" value="Vote" />
<a href="https://www.contentteller.com/poll.php?id=$polldata[poll_id]">Details</a>
</form>
</font></td>
</tr>
</table>
</td>
</tr>
</table>
You need to add the second code in the HTML part of the template where the poll block should appear.
I hope everything is clear. Let me know if you have any questions.
1 Re: Help
Rushian 0
From: -
From: -
Help
Yeah, I'd like to do this myself...
skylar
Posted - 2005-04-07 21:24:00
how do i put the poll on the main page to under the poll header o nthe left this scripts is to confusing way to spread out.
Yeah, I'd like to do this myself...
Ok sofar I got the design www.hwlogic.com/cms/ now how do i put the poll on the main page to under the poll header o nthe left this scripts is to confusing way to spread out.