Author |
Message |
24/06/2004 04:02:20
|
WillBoss
Newbie
Joined: 24/06/2004 03:57:24
Messages: 1
Location: ireland
Offline
|
Hi
I am running the Advance Poll script on my computer before I upload it to a website. I am using random polls with a pop up window for the results but I also want the comments for that particular poll to be displayed with them. I am at a loss can anyone help as I cannot figure out how this can be done.
Cheers!!
Will
|
|
29/06/2004 04:36:10
|
Anonymous
|
I use this code for Advance Poll script,
I tried many combinations to get this right for my page latout,
however, the limiting line was always:
$CLASS["db"]->connect();
*** $php_poll = new pollcomment(); ***
<?php
$poll_path = "/home/web/poll/db";
require $poll_path."/include/config.inc.php";
require $poll_path."/include/$POLLDB[class]";
require $poll_path."/include/class_poll.php";
require $poll_path."/include/class_pollcomment.php";
$CLASS["db"] = new polldb_sql;
$CLASS["db"]->connect();
$php_poll = new pollcomment();
/* question */
echo $php_poll->get_poll_question(1);
/* poll */
$php_poll->set_template_set("plain");
$php_poll->set_max_bar_length(45);
$php_poll->set_max_bar_height(3);
echo $php_poll->poll_process(1);
/* poll comments */
$php_poll->set_template("poll_comment");
$php_poll->set_comments_per_page(2);
$php_poll->set_date_format("d/m/Y");
$php_poll->data_order_by("time","desc");
echo $php_poll->view_poll_comments(1);
echo $php_poll->get_comment_pages(1);
?>
|
|
26/09/2004 12:03:36
|
Anonymous
|
Rayzun, I tried your code but this is not the solution. There is not even a pop-up window! The question is: how to get the commands in the popup-window with the results of the poll.
I have posted a new topic on september 26th with this question.
Or, Will Boss, did you allready work it out? Please let me know then.
|
|
26/09/2004 12:56:11
|
Anonymous
|
Hi, I found the solution myself! I am new to php but tried things out and it works!
Before you trie the solution I found, make a copy of the original popup.php, just in case that my solution does not work out for you.
And: your poll_path in the first line of the code can be different from mine! Perhaps you need the poll_path from the original popup.php file.
Open the file popup.php, and replace the php-code between the <body>tags with this one:
-----------------------------------
<?php
$poll_path = "/home/virtual/site24/fst/var/www/html/poll";
require $poll_path."/include/class_pollcomment.php";
$php_poll = new pollcomment();
$php_poll->set_template_set("popup");
if (isset($poll_ident) && isset($action)) {
$php_poll->set_max_bar_length(110);
echo $php_poll->poll_process($poll_ident);
$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");
echo $php_poll->view_poll_comments($poll_ident);
echo $php_poll->get_comment_pages($poll_ident);
}
?>
-----------------------------------
In the file where you want to show your poll you embed your poll with this code (replace the "4" in the last lines with the ID-number of your poll):
<?php
/* Include this before your html code */
include "./poll_cookie.php";
?>
<?php
/* Include this in the body of the html code where you want to show the poll*/
$poll_path = "/home/virtual/site24/fst/var/www/html/poll";
require $poll_path."/include/config.inc.php";
require $poll_path."/include/$POLLDB[class]";
require $poll_path."/include/class_poll.php";
$CLASS["db"] = new polldb_sql;
$CLASS["db"]->connect();
$php_poll = new poll();
$php_poll->set_template_set("popup");
if ($php_poll->is_valid_poll_id(4)) {
echo $php_poll->display_poll(4);
}
?>
|
|
|