If you are not registered or logged in, you may still use these forums but with limited features. Show recent topics
  [Search] Search   [Hottest Topics] Hottest Topics   [Members]  Member Listing   [FAQ]  FAQ 
[Register] Register / 
[Login] Login 
How to combine Poll List & Comment?  XML
Forum Index » Support Forum
Author Message
hityr5yr
Newbie

Joined: 29/07/2008 18:52:45
Messages: 1
Offline

I see that another user has asked same question, but so far there is no answer.

I tried to resolve the issue tough I'm not familiar in PHP at all. I got some success but only partial. Meaning that I added the Poll List to Demo 4 Poll version (the code is below). When I load another poll from the list everything is OK - it loads with its comments and submission form. The problem is that when I try to post a comment under that poll nothing happens. Except that the initial poll page loads.

I believe many people would want to combine the list and the comments option, that is why I raise the question again.

Anybody help?

Here is the code:

<?php

require_once $poll_path."pollphp/include/config.inc.php";
require_once $poll_path."pollphp/include/$POLLDB[class]";
require_once $poll_path."pollphp/include/class_poll.php";
require_once $poll_path."pollphp/include/class_pollcomment.php";
require_once $poll_path."pollphp/include/class_captchatest.php";
require_once $poll_path."pollphp/include/class_plist.php";

$CLASS["db"] = new polldb_sql;
$CLASS["db"]->connect();

$php_poll = new plist();

/* poll */
$php_poll->set_template_set("plain");
$php_poll->set_max_bar_length(125);
$php_poll->set_max_bar_height(10);

if (isset($_GET['poll_id'])) {
echo $php_poll->poll_process($_GET['poll_id']);
} else {
echo $php_poll->poll_process("1");
}

/* poll list */
$php_poll->set_template("poll_list");
$php_poll->set_date_format("m/d/Y");
echo $php_poll->view_poll_list();
echo $php_poll->get_list_pages();

$php_poll = new pollcomment();

/* construct the form */
$php_poll->set_template("poll_form");
$php_poll->set_form_error(array("name" => "Please enter your name.", "email" => "You must specify your e-mail address.", "message" => "You must specify a message.", "captcha" => "You must specify the correct key."));

if (isset($_GET['poll_id'])) {
echo $php_poll->comment_process($_GET['poll_id']);
} else {
echo $php_poll->comment_process("1");
}

/* poll comments */
$php_poll->set_template("poll_comment");
$php_poll->set_comments_per_page(5);
$php_poll->set_date_format("d/m/Y H:i");
$php_poll->data_order_by("time","desc");

if (isset($_GET['poll_id'])) {
echo $php_poll->view_poll_comments($_GET['poll_id']);
} else {
echo $php_poll->view_poll_comments("1");
}

if (isset($_GET['poll_id'])) {
echo $php_poll->get_comment_pages($_GET['poll_id']);
} else {
echo $php_poll->get_comment_pages("1");
}

/* form */
echo $html_form;
?>
Jack A
Newbie

Joined: 13/08/2008 22:58:33
Messages: 2
Location: Dallas TX USA
Offline

I believe many people would want to combine the list and the comments option, that is why I raise the question again.


1. admin > choose your poll > make sure "Allow comments" is checked in the lower right of the page for that poll
2. To show all the Comments below your poll on your page after a vote has been cast, you need to do this, found in the setup instructions, referring to the instructions you see after you first install the app, not the readme.txt, although it may be there as well:

Advanced Poll also support comments:

For comments to work, you must have checked off the "allow comments" box when creating your poll. If you did that, then there will automatically be a link to add a comment to a poll just using the process_poll command. However, the comments will not be displayed anywhere (besides in the admin area), unless you add some more PHP code: <?php
include_once "/booth.php"; # don't use this again if you already have it on the page somewhere.
$php_poll->set_template("poll_comment"); # required to switch to comment mode!
$php_poll->set_comments_per_page(5); # maximum comments to show per page.
$php_poll->set_date_format("d/m/Y H:i"); # how to display the time stamp on comments.
$php_poll->data_order_by("time","desc"); # how to sort the comments. (show oldest first with ("time","asc"))
echo $php_poll->view_poll_comments(ID#); # displays the comments for poll ID#.
echo $php_poll->get_comment_pages(ID#); # displays "next page","last page" thing when you have lots of comments.
?>


If you have modified the php scripts, I'm not sure the above will work. In that case, I would replace your modifications with the original scripts and try it.

Jack Andrews
http://www.andrewsontheweb.com
[WWW]
 
Forum Index » Support Forum
Go to:   
Based on the open source JForum