Kommentar posten u. Bewerten mit einem Klick...? Habe die Lösung gefunden...!
Comment and rate with one Click...? I found the Answer...! Folgender Code ist von V@no:
http://www.4homepages.de/forum/index.php?topic=4023.0 The following code is from V@no:
http://www.4homepages.de/forum/index.php?topic=4023.0Schritt 1. / Step 1. Öffne details.php und finde:
Open details.php and find:
$sql = "INSERT INTO ".COMMENTS_TABLE."
Füge
davor folgenden Code ein:
Insert
above following Code:
//-----------------------------------------------------
//--- Save Rating -------------------------------------
//-----------------------------------------------------
if (intval($HTTP_POST_VARS['rating']) != "") {
$rating = intval($HTTP_POST_VARS['rating']);
$cookie_name = (defined("COOKIE_NAME")) ? COOKIE_NAME : "4images_";
$cookie_rated = isset($HTTP_COOKIE_VARS[$cookie_name.'rated']) ? unserialize(stripslashes($HTTP_COOKIE_VARS[$cookie_name.'rated'])) : array();
if ($rating && $rating <= MAX_RATING && $id) {
if (!isset($session_info['rated_imgs'])) {
$session_info['rated_imgs'] = $site_sess->get_session_var("rated_imgs");
}
$split_list = array();
if (!empty($session_info['rated_imgs'])) {
$split_list = explode(" ", $session_info['rated_imgs']);
}
if (!in_array($id, $split_list) && !in_array($id, $cookie_rated)) {
$session_info['rated_imgs'] .= " ".$id;
$session_info['rated_imgs'] = trim($session_info['rated_imgs']);
$site_sess->set_session_var("rated_imgs", $session_info['rated_imgs']);
$cookie_rated[] = $id;
$cookie_expire = time() + 60 * 60 * 24 * 4;
setcookie($cookie_name.'rated', serialize($cookie_rated), $cookie_expire, COOKIE_PATH, COOKIE_DOMAIN, COOKIE_SECURE);
update_image_rating($id, $rating);
$msg_color = 1;
$msg = $lang['voting_success'];
}
else {
$msg = $lang['already_voted'];
}
}
else {
$msg = $lang['voting_error'];
}
}
//////////////////////////////////////////
Schritt 2. / Step 2. Das ist der Code meiner
comment_form.html. Die Optik ist Deine Sache.
This is the Code of my
comment_form.html. Visually it is your affair.
<table width="100%" border="0" cellspacing="0" cellpadding="1" align="center">
<tr>
<td valign="top" class="head1">
<table width="100%" border="0" cellpadding="3" cellspacing="0">
<tr>
<td valign="top" class="head1">{lang_post_comment}</td>
</tr>
<tr>
<td valign="top" class="row1">
<form name="commentform" action="{self}" method="post" onsubmit="postbutton.disabled=true;">
<input type="hidden" name="id" value="{image_id}" />
<input type="hidden" name="action" value="postcomment" />
<input type="hidden" name="action" value="rateimage" />
<table cellpadding="4" cellspacing="0" border="0">
<tr>
<td width="90" height="31"><b>{lang_name}</b></td>
<td height="31"><input type="text" name="user_name" size="30" value="{user_name}" class="commentinput" /></td>
</tr>
<tr>
<td width="140" valign="top"><b>{lang_comment}</b></td>
<td valign="top"> <table border="0" width="100%">
<tr>
<td width="301" valign="top"><textarea name="comment_text" id="content" cols="35" rows="10" maxlength="500" OnFocus="CountMax();" OnClick="CountMax();"
ONCHANGE="CountMax();" onKeydown="CountMax();" onKeyup="CountMax();" wrap="soft" class="commenttextarea" onFocus=myselection(this) onclick=myselection(this) onChange=myselection(this)>{comment_text}</textarea></td>
<td>
<table cellpadding="4" cellspacing="0" border="0" width="384">
<tr>
<td width="58%" valign="bottom">{if rate_form}<p> </p>
<p><input type="radio" name="rating" value="5">+5 Punkte
<br>
<input type="radio" name="rating" value="4">+4 Punkte <br>
<input type="radio" name="rating" value="3">+3 Punkte <br>
<input type="radio" name="rating" value="2">+2 Punkte <br>
<input type="radio" name="rating" value="1">+1 Punkte <br>
<input type="radio" name="rating" value="0" checked="">Keine Wertung {endif rate_form}<br>
<br>
<input type="submit" name="postbutton" value="Kommentar posten" class="button" /></td>
</tr>
</table>
</td>
</tr>
</table>
<p> {bbcode}</td>
</td>
</tr>
<tr>
<td width="90" valign="top" height="53"> </td>
<td height="53">
</td>
</tr>
<tr>
{if captcha_comments}
<tr>
<td width="90" valign="top"><b>{lang_captcha}</b></td>
<td>
<a href="javascript:new_captcha_image();"><img src="{url_captcha_image}" border="0" id="captcha_image" /></a>
<br />
<input type="text" name="captcha" size="30" value="" class="commentinput" id="captcha_input" />
<br />
{lang_captcha_desc}
<table border="0" cellspacing="0" cellpadding="3" class="row1">
<tr>
</tr>
</table>
</td>
</tr>
{endif captcha_comments}
<td width="90" valign="top"> </td>
<td>
<input type="hidden" name="action" value="postcomment" />
<input type="hidden" name="id" value="{image_id}" />
<p>
<input type="hidden" class="button" name="submit">
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</td>
</tr>
</table>
Bei mir funzt es einwandfrei...!
It works on my Site
Gruß
Ralf