Hallo an das Forum,
ich habe ein Umfrageskript auf meiner Site eingebunden, schaffe es aber nicht, die Ausgabe der Fragen rechtsbündig zu layouten.
Zu sehen unter:
http://www.kuerbiskernoelshop.com/nebau ... p?idcat=86
Ich hätte gerne, dass die Radiobuttons komplett linksbündig stehen. Kann mir mal jemand einen Tipp geben.
Anbei der Outputcode sowie die CSS:
<?php
/********************************************************
* CONTENIDO MODUL - OUTPUT
*
* Modulname : Umfrage
* Author : Alexander Höhn
* Copyright : art & weise medienproduktion
info@auw-media.de
* Created : 16-09-2002
* Modified : 04-07-2003
* Modified again & again until: May. 12th 2004 by Lars D. Forseth <lars@forseth.de>
*********************************************************/
/* set this to "yes" if you want to run script in debugging mode */
$debugging = "no";
/* end "set this to "yes" if you want to run script in debugging mode" */
/* get only vars accepted by POST or GET */
$poll_action = $_POST['poll_action'];
$given_answer = $_POST['given_answer'];
$poll_stats = $_GET['poll_stats'];
if ($debugging == "yes") echo "- poll_action: $poll_action<br>";
if ($debugging == "yes") echo "- given_answer: $given_answer<br>";
if ($debugging == "yes") echo "- poll_stats: $poll_stats<br>";
if ($debugging == "yes") echo "- cookie: ".($_COOKIE['poll'])."<br>";
/* end "get only vars accepted by POST or GET" */
$db1 = new DB_Contenido;
/* lock tables */
$db1->query("LOCK TABLES poll WRITE,poll_log WRITE;");
/* end "lock tables" */
/* get * from active poll */
$db1->query("SELECT * FROM poll WHERE poll_active=1 LIMIT 1;");
$db1->next_record();
$poll_id_active = $db1->f("poll_id");
/* no active poll in DB */
if (!isset($poll_id_active)) {echo "Keine aktive Umfrage in der DB vorhanden!";}
/* end "no active poll in DB" */
/* there is an active poll in DB */
else {
$poll_question_active = $db1->f("poll_question");
$poll_answer1_active = $db1->f("poll_answer1");
$poll_answer2_active = $db1->f("poll_answer2");
$poll_answer3_active = $db1->f("poll_answer3");
$poll_answer4_active = $db1->f("poll_answer4");
$poll_answer5_active = $db1->f("poll_answer5");
$poll_answer6_active = $db1->f("poll_answer6");
if ($debugging == "yes") echo "- poll_id_active: $poll_id_active<br>";
/* end "get od from active poll" */
/* get user's ip and proxy ip */
$user_ip = $_SERVER['REMOTE_ADDR'];
$user_proxy = $_SERVER['HTTP_X_FORWARDED_FOR'];
/* end "get user's ip and proxy ip" */
/* user is only allowed to vote if cookies are enabled and his IP isn't blocked (anymore) */
if ($poll_stats == "yes") {$poll_action = "vote"; $given_answer = 666;}
if ($poll_action == "vote") {
$db0 = new DB_Contenido;
$sql = "SELECT poll_log_id,user_time FROM poll_log WHERE poll_id=$poll_id_active ".
"and user_ip='$user_ip' ORDER BY user_time DESC LIMIT 1;";
$db0->query($sql);
$db0->next_record();
$poll_log_id = $db0->f("poll_log_id");
$user_time = $db0->f("user_time");
if ($debugging == "yes") {
echo "- poll_action: $poll_action<br>";
echo "- poll_id_active: $poll_id_active<br>";
echo "- user_time: $user_time<br>- poll_log_id: $poll_log_id<br>";
} // end if ($debugging == "yes")
if ((isset($user_time)) and (isset($poll_log_id))) {
if ($debugging == "yes") echo "- user_time: $user_time<br>- poll_log_id: $poll_log_id<br>";
$block_seconds = 0;
$block_minutes = 15;
$block_hours = 0;
$block_days = 0;
$block_months = 0;
$block_total = ($block_seconds + ($block_minutes * 60) + ($block_hours * 60 * 60)
+ ($block_days * 60 * 60 * 24) + ($block_months * 60 * 60 * 24 * 30));
// IP is still blocked
if ((time()) < ($user_time + $block_total)) {
$poll_stats = "yes";
$given_answer = 666;
if ($debugging == "yes") echo "- poll_stats: $poll_stats<br>- given_answer: $given_answer<br>";
$db0->query("UPDATE poll_log SET user_time=UNIX_TIMESTAMP() WHERE poll_log_id=$poll_log_id;");
} // end if
} // end if
} // end if
/* end "user is only allowed to vote if cookies are enabled" and his IP isn't blocked (anymore) */
echo "
<!-- umfragenmodul -->
";
/* allowed to vote and no form data given -> show poll form */
if((($_COOKIE['poll']) == "poll_allowed")
and ($poll_action != "vote") and ($poll_stats != "yes")){
$links = explode('?',$auth->url());
$links2 = explode('&',$links[1]);
$link = $links[0].'?'.$links2[0];
if ($debugging == "yes") echo "- link: $link<br>";
echo "
<form action=\"$link\" method=\"post\" name=\"poll_form\">";
echo "
<table width=\"600\" cellspacing=\"0\" cellpadding=\"2\" class=\"poll\">
<tr>
<td colspan=\"2\" align=\"left\" class=\"poll_question\">$poll_question_active<br></td>
</tr>
<tr><td colspan=\"2\"> </td></tr>
<tr class=\"text\">
<td width=\"25\"></td><td><input value=\"1\" type=\"radio\" name=\"given_answer\"> $poll_answer1_active</td>
</tr>
<tr class=\"text\">
<td width=\"25\" ></td><td><input value=\"2\" type=\"radio\" name=\"given_answer\"> $poll_answer2_active</td>
</tr>";
// poll_answer3 to poll_answer6 are optional...
if(strlen($poll_answer3_active) > 1)
echo "
<tr class=\"text\">
<td width=\"25\" ></td><td><input value=\"3\" type=\"radio\" name=\"given_answer\"> $poll_answer3_active</td>
</tr>";
if(strlen($poll_answer4_active) > 1)
echo "
<tr class=\"text\">
<td width=\"25\" ></td><td><input value=\"4\" type=\"radio\" name=\"given_answer\"> $poll_answer4_active</td>
</tr>";
if(strlen($poll_answer5_active) > 1)
echo "
<tr class=\"text\">
<td width=\"25\" ></td><td><input value=\"5\" type=\"radio\" name=\"given_answer\"> $poll_answer5_active</td>
</tr>";
if(strlen($poll_answer6_active) > 1)
echo "
<tr class=\"text\">
<td width=\"25\" ></td><td><input value=\"6\" type=\"radio\" name=\"given_answer\"> $poll_answer6_active</td>
</tr>";
echo "<tr>
<td> </td><td> </td>
</tr class=\"text\">
<tr>
<td colspan =\"2\">
<input type=\"hidden\" name=\"poll_id\" value=\"".$poll_id_active."\">
<input type=\"hidden\" name=\"poll_action\" value=\"vote\">
<center><input type=\"submit\" class=\"poll_button\" value=\"Abstimmen\"><br>
<!-- end of poll_form -->
</form>
<!-- -->
</tr>";
} /* end "allowed to vote and no form data given -> show poll form" */
/* show poll stats and store vote if there was one given */
else {
$db = new DB_Contenido;
// if given_answer is valid, store it in poll_log
if ((ereg("^[1-6]{1}$",$given_answer)) and ($poll_stats != "yes")) {
if ($debugging == "yes") echo "- given_answer: $given_answer<br>- poll_stats: $poll_stats<br>";
$sql = "INSERT INTO poll_log VALUES (\"\",$poll_id_active,".
"$given_answer,\"$user_ip\",\"$user_proxy\",UNIX_TIMESTAMP());";
$db->query($sql);
} // end if
$db->query("SELECT COUNT(*) FROM poll_log WHERE poll_id=$poll_id_active and user_vote=1;");
$db->next_record();
$result1 = $db->f("COUNT(*)");
$db->query("SELECT COUNT(*) FROM poll_log WHERE poll_id=$poll_id_active and user_vote=2;");
$db->next_record();
$result2 = $db->f("COUNT(*)");
$db->query("SELECT COUNT(*) FROM poll_log WHERE poll_id=$poll_id_active and user_vote=3;");
$db->next_record();
$result3 = $db->f("COUNT(*)");
$db->query("SELECT COUNT(*) FROM poll_log WHERE poll_id=$poll_id_active and user_vote=4;");
$db->next_record();
$result4 = $db->f("COUNT(*)");
$db->query("SELECT COUNT(*) FROM poll_log WHERE poll_id=$poll_id_active and user_vote=5;");
$db->next_record();
$result5 = $db->f("COUNT(*)");
$db->query("SELECT COUNT(*) FROM poll_log WHERE poll_id=$poll_id_active and user_vote=6;");
$db->next_record();
$result6 = $db->f("COUNT(*)");
$total = $result1+$result2+$result3+$result4+$result5+$result6;
echo "
<table width=\"600\" cellspacing=\"0\" cellpadding=\"2\" class=\"poll\">";
echo "
<tr class=\"poll_question\"><td>".$poll_question_active."</td></tr><tr><td> </td></tr>";
echo "
<tr class=\"text\"><td><i><u>Gesamt:</u> ".$total." Stimmen</i></td></tr><tr><td> </td></tr>";
if (($result1 > 0) and ($total > 0)) $percent = round(((100*$result1)/$total), 2);
if($result1!="0") $class1= "bar1";
if ($percent < 5.00) $class1 = "";
echo "
<tr class=\"text\"><td>\"<b>".$poll_answer1_active."</b>\" (".$result1.") :</td></tr>";
echo "
<tr><td>
<table><tr class=\"text\"><td class=\"".$class1."\" width=\"".$percent."\"> </td></tr></table>";
echo "
</td></tr>
";
if (($result2 > 0) and ($total > 0)) $percent = round(((100*$result2)/$total), 2);
if($result2!="0") $class2= "bar2";
if ($percent < 5.00) $class2 = "";
echo "
<tr class=\"text\"><td>\"<b>".$poll_answer2_active."</b>\" (".$result2.") :</td></tr>";
echo "
<tr><td>
<table><tr class=\"text\"><td class=\"".$class2."\" width=\"".$percent."\"> </td></tr></table>";
echo "
</td></tr>
";
if(strlen($poll_answer3_active) > 1){
if (($result3 > 0) and ($total > 0)) $percent = round(((100*$result3)/$total), 2);
if($result3!="0") $class3= "bar3";
if ($percent < 5.00) $class3 = "";
echo "
<tr class=\"text\"><td>\"<b>".$poll_answer3_active."</b>\" (".$result3.") :</td></tr>";
echo "
<tr><td>
<table><tr class=\"text\"><td class=\"".$class3."\" width=\"".$percent."\"> </td></tr></table>";
echo "
</td></tr>
";
}
if(strlen($poll_answer4_active) > 1){
if (($result4 > 0) and ($total > 0)) $percent = round(((100*$result4)/$total), 2);
if($result4!="0") $class4= "bar4";
if ($percent < 5.00) $class4 = "";
echo "
<tr class=\"text\"><td>\"<b>".$poll_answer4_active."</b>\" (".$result4.") :</td></tr>";
echo "
<tr><td>
<table><tr class=\"text\"><td class=\"".$class4."\" width=\"".$percent."\"> </td></tr></table>";
echo "
</td></tr>
";
}
if(strlen($poll_answer5_active) > 1){
if (($result5 > 0) and ($total > 0)) $percent = round(((100*$result5)/$total), 2);
if($result5!="0") $class5= "bar5";
if ($percent < 5.00) $class5 = "";
echo "
<tr class=\"text\"><td>\"<b>".$poll_answer5_active."</b>\" (".$result5.") :</td></tr>";
echo "
<tr><td>
<table><tr class=\"text\"><td class=\"".$class5."\" width=\"".$percent."\"> </td></tr></table>";
echo "
</td></tr>
";
}
if(strlen($poll_answer6_active) > 1){
if (($result6 > 0) and ($total > 0)) $percent = round(((100*$result6)/$total), 2);
if($result6!="0") $class6= "bar6";
if ($percent < 5.00) $class6 = "";
echo "
<tr class=\"text\"><td>\"<b>".$poll_answer6_active."</b>\" (".$result6.") :</td></tr>";
echo "
<tr><td>
<table><tr class=\"text\"><td class=\"".$class6."\" width=\"".$percent."\"> </td></tr></table>";
echo "
</td></tr>
";
}
} // end else
/* print stats link only if stats aren't displayed already */
if ((($_COOKIE['poll']) == "poll_allowed") and ($poll_action != "vote") and ($poll_stats != "yes")) {
echo "
<!-- poll_stats button -->
<tr>
<td colspan=\"2\" align=\"center\">
<div align=\"center\"><a href=\"$PHP_SELF?idcat=$idcat&poll_stats=yes\">Statistik »</a></div>
</td>
</tr>
<!-- end poll_stats button -->";
}
/* end "print stats link only if stats aren't displayed already" */
echo "
</table>
";
}
/* end "there is an active poll in DB" */
echo "
<!-- end umfragenmodul -->
";
/* unlock tables */
$db1->query("UNLOCK TABLES;");
/* end "unlock tables" */
?>
Die CSS-Datei:
poll {
BORDER-RIGHT: #000000 0px solid; BORDER-TOP: #000000 0px solid;
MARGIN-BOTTOM: 3pt; BORDER-LEFT: #000000 0px solid; BORDER-BOTTOM: #000000 0px solid;
BACKGROUND-COLOR: #ffffff; boder-collapse:collapse; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px;
}
.poll_question {
padding-left: 5px; padding-right: 3x; padding-top: 3px; padding-bottom: 3px;
color: black; BACKGROUND-COLOR: #ededed; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px;
}
.poll_button {
BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid; FONT-SIZE: 10pt;
BORDER-LEFT: black 1px solid; COLOR: #000000; BORDER-BOTTOM: black 1px solid;
FONT-STYLE: italic; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif;
BACKGROUND-COLOR: #ffffff;
}
.bar1 {
background: #ffa500;
border-bottom: 1px solid Black;
border-left: #CCCCCC 1px solid;
border-right: 1px solid Black;
border-top: #CCCCCC 1px solid;
font-size: 1px;
color: #333399;
}
.bar2 {
background-image: url(../images/bar_back.jpg);
background: #ffa500;
border-bottom: 1px solid Black;
border-left: #CCCCCC 1px solid;
border-right: 1px solid Black;
border-top: #CCCCCC 1px solid;
background-repeat: repeat;
font-size: 1px;
color: #333399;
}
.bar3 {
background-image: url(../images/bar_back.jpg);
background: #ffa500;
border-bottom: 1px solid Black;
border-left: #CCCCCC 1px solid;
border-right: 1px solid Black;
border-top: #CCCCCC 1px solid;
background-repeat: repeat;
font-size: 1px;
color: #333399;
}
.bar4 {
background-image: url(../images/bar_back.jpg);
background: #ffa500;
border-bottom: 1px solid Black;
border-left: #CCCCCC 1px solid;
border-right: 1px solid Black;
border-top: #CCCCCC 1px solid;
background-repeat: repeat;
font-size: 1px;
color: #333399;
}
.bar5 {
background-image: url(../images/bar_back.jpg);
background: #ffa500;
border-bottom: 1px solid Black;
border-left: #CCCCCC 1px solid;
border-right: 1px solid Black;
border-top: #CCCCCC 1px solid;
background-repeat: repeat;
font-size: 1px;
color: #333399;
}
.bar6 {
background-image: url(../images/bar_back.jpg);
background: #ffa500;
border-bottom: 1px solid Black;
border-left: #CCCCCC 1px solid;
border-right: 1px solid Black;
border-top: #CCCCCC 1px solid;
background-repeat: repeat;
font-size: 1px;
color: #333399;
}
.text {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px; text-align: left;
}
.text_bold { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; font-weight: bolder; }
Layout Umfrage
-
- Beiträge: 1536
- Registriert: Fr 20. Aug 2004, 10:07
- Kontaktdaten:
also punkt vor die klasse poll
und dann füge mal das hier in diese Klasse eins
Außerdem sollte an dieser stelle noch ein Endtag gesetzt werden
so (ungetestet) ansonsten stimmt dein Html nicht ganz
Code: Alles auswählen
.poll {
BORDER-RIGHT: #000000 0px solid; BORDER-TOP: #000000 0px solid;
MARGIN-BOTTOM: 3pt; BORDER-LEFT: #000000 0px solid; BORDER-BOTTOM: #000000 0px solid;
BACKGROUND-COLOR: #ffffff; boder-collapse:collapse; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px;
}
Code: Alles auswählen
text-align:right;
Außerdem sollte an dieser stelle noch ein Endtag gesetzt werden
Code: Alles auswählen
<!-- end of poll_form -->
</form>
<!-- -->
</tr>";
so (ungetestet) ansonsten stimmt dein Html nicht ganz
Code: Alles auswählen
<!-- end of poll_form -->
</form>
<!-- -->
</tr></table>";
greets