Web Poll Content Type
Web Poll Content Type
Thought I'd share my latest enhancement, a web poll for phpwcms.
See demo and download from: http://www.ikfrej.se/index.php?downloads
Cheers!
See demo and download from: http://www.ikfrej.se/index.php?downloads
Cheers!
Hi JensZ,
great addition! Little mod, big effects, thanks.
Your one of my favourite MOD-man
Cheers
great addition! Little mod, big effects, thanks.
Your one of my favourite MOD-man

Cheers
1.3 out, testing, testing...
Sponsoring 4 phpwcms Blog and Usermanagement
Sponsoring 4 phpwcms Blog and Usermanagement
The results are shown once the user hits send. However, minutes after I released the code I actually added code so that the results can be seen in the backend. Now I'm too lazy to wrap up another package, it'll come in the next version along with code that allows the poll and results to be rendered using templates. Replace inc_tmpl\cnt89.list.inc.php with this to get it to appear in the backend:
Code: Select all
<?php
/*************************************************************************************
Copyright notice
(c) 2002-2005 Oliver Georgi (oliver@phpwcms.de) // All rights reserved.
This script is part of PHPWCMS. The PHPWCMS web content management system is
free software; you can redistribute it and/or modify it under the terms of
the GNU General Public License as published by the Free Software Foundation;
either version 2 of the License, or (at your option) any later version.
The GNU General Public License can be found at http://www.gnu.org/copyleft/gpl.html
A copy is found in the textfile GPL.txt and important notices to the license
from the author is found in LICENSE.txt distributed with these scripts.
This script is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.
This copyright notice MUST APPEAR in all copies of the script!
*************************************************************************************/
// Content 89: Poll jens
$cinfo["result"] = $row["acontent_title"] ? cut_string($row["acontent_title"],"…", 55) : "";
$cinfo["result"] .= ($cinfo["result"] && $row["acontent_subtitle"]) ? " / " : "";
$cinfo["result"] .= $row["acontent_subtitle"] ? cut_string($row["acontent_subtitle"],"…", 55) : "";
$poll_text = unserialize($row["acontent_text"]);
$poll_form = unserialize($row["acontent_form"]);
$poll_image = unserialize($row["acontent_image"]);
$total_votes = 0;
foreach($poll_form["count"] as $key => $value)
{
$total_votes += $value;
}
$html .= "<table>";
$html .= "<tr>\n<td><table>";
if($total_votes > 0)
{
$cnt = max(count($poll_form["choice"]), count($poll_image["images"]));
for($key = 0; $key < $cnt; $key++)
{
$html .= '<tr><td class="v10">';
if(isset($poll_form["choice"][$key]) && !empty($poll_form["choice"][$key]))
{
$html .= $poll_form["choice"][$key];
}
//if(is_array($poll_image["images"][$key]) && count($poll_image["images"][$key]))
//{
// $html .= "<br/>";
// $html .= showPollImage($poll_image["images"][$key]);
//}
$html .= '</td><td class="v10"><span style="float: left; height: 13px; background-color: #0FA5FB; border-top: 1px solid #78CBFB; border-left: 1px solid #78CBFB; border-right: 1px solid #0AA3BE; border-bottom: 1px solid #0AA3BE; margin: .2em 0 .5em 0; width:'.round(($poll_form["count"][$key]/$total_votes*100),0).'px;"><!-- --></span> <span style="">'.round(($poll_form["count"][$key]/$total_votes*100),0).'%</span></td></tr>'."\n";
}
}
$html .= "<tr><td class=\"v10\"><span style=\"font-weight:bold;\">total votes:</span> ".$total_votes."</td></tr>";
$html .= "</table></td>\n</tr>";
$html .= "</table>";
if($cinfo["result"])
{
echo "<tr><td> </td><td class=\"v10\">";
echo "<a href=\"phpwcms.php?do=articles&p=2&s=1&aktion=2&id=".$article["article_id"]."&acid=".$row["acontent_id"]."\">";
echo $cinfo["result"]."</a>".$html."</td><td> </td></tr>";
}
?>
Hi,
made a test here:
http://www.piezoworks.be/mulieris/index.php?fr_mulieris
Works like a charm!!!
Some questions though... You might think "they're never happy, I break my b* to do a nice CP and they complain!" No, no, I was just wondering about these things:
Q: what is the time limit to re-enter the vote? (cookie based/session?) I suppose I can change the value?
Q: every time I edit the poll, it resets the results to 0... no tbig deal but can be annoying for future aplpications.
Q: I don't get th eimage thing, it only shows under the first choice...
Anyway, very nice job!
Thanks again!
Cheers
made a test here:
http://www.piezoworks.be/mulieris/index.php?fr_mulieris
Works like a charm!!!




Some questions though... You might think "they're never happy, I break my b* to do a nice CP and they complain!" No, no, I was just wondering about these things:
Q: what is the time limit to re-enter the vote? (cookie based/session?) I suppose I can change the value?
Q: every time I edit the poll, it resets the results to 0... no tbig deal but can be annoying for future aplpications.
Q: I don't get th eimage thing, it only shows under the first choice...
Anyway, very nice job!
Thanks again!
Cheers
1.3 out, testing, testing...
Sponsoring 4 phpwcms Blog and Usermanagement
Sponsoring 4 phpwcms Blog and Usermanagement
Stupid me... if I add 4 choices, then I have to add 4 images, ok got it...Kosse wrote: Q: I don't get the image thing, it only shows under the first choice...

Note: funny, 12 pple voted so far

Cheers
1.3 out, testing, testing...
Sponsoring 4 phpwcms Blog and Usermanagement
Sponsoring 4 phpwcms Blog and Usermanagement
hey,
what about placing the total numbers of votes....?
OFftopic - how did you made this:
what about placing the total numbers of votes....?
OFftopic - how did you made this:
Updated 2 sec after I posted..Läst 411 gånger (idag: 7)

Display number of users currently online, number of visitors, number of times a page/article has been viewed, and more. Requires VTS
http://www.studmed.dk Portal for doctors and medical students in Denmark
Frold,
To show the total number of votes replace
with
To get the number of times an article has been read, install the vts_users_online.zip package and put something like this in your article template:
cheers
/Jens
To show the total number of votes replace
Code: Select all
$html .= "</table></td>\n</tr>";
$html .= "</table>";
Code: Select all
$html .= "</table></td>\n</tr>";
$html .= "<tr><td><span style=\"font-weight:bold;\">total votes:</span> ".$total_votes."</td></tr>";
$html .= "</table>";
Code: Select all
<div>
[TITLE]<h1 style="margin:0 0 5px 0;">{TITLE}</h1>[/TITLE]
[SUB]<h3 style="margin:0 0 5px 0;">{SUB}</h3>[/SUB]
<p style="margin:5px 0 5px 0;">
<span>{DATE:Y-m-d:EN}</span>
<span>
Read {VTS_DOCUMENT:total} times (today: {VTS_DOCUMENT:today}).</span><br />
{SUMMARY}
</p>
<br/>
</div>
/Jens
Done, works like a charm (as always) thx JensZJensZ wrote:To show the total number of votes replace
Cheers
1.3 out, testing, testing...
Sponsoring 4 phpwcms Blog and Usermanagement
Sponsoring 4 phpwcms Blog and Usermanagement
-
- Posts: 51
- Joined: Wed 10. Nov 2004, 21:48
- Location: London
Re: Web Poll Content Type
Another awesome content part..!!.I use both of your {SHOW_CONTENT} and {NEWS_FLASH} hacks....I haven't installed this one yet as it looks that this one involves modifying the same core files...Is this the case..??JensZ wrote:Thought I'd share my latest enhancement, a web poll for phpwcms.
See demo and download from: http://www.ikfrej.se/index.php?downloads
Cheers!
-
- Posts: 51
- Joined: Wed 10. Nov 2004, 21:48
- Location: London
Fine this MOD, but I have one question. How to hide the poll results to end off poll period (secret poll)?JensZ wrote:Yes, changes are made to the same files, but the changes are minor. A function in front.func.inc.php and a line or two in the other files. Just look for "jens" to find the lines that changed and merge them in.
eg.: after user vote, say "thx, the vote. Results later..."
Thx, Paul