new field in newsdatabase or new table so it could be more comments to one news
Code: Select all
comment X,
Code: Select all
echo "<td>".$this->CreateLink($id, 'News', $returnid, 'Comment', array("action"=>"comment","newsid"=>$row["news_id"]))."</td>\n";
Code: Select all
case "comment":
$newsid = (isset($_GET[$id."newsid"])?$_GET[$id."newsid"]:"").(isset($_POST[$id."newsid"])?$_POST[$id."newsid"]:"");
$query = "SELECT * FROM ".cms_db_prefix()."module_news WHERE news_id = ".$newsid."";
$dbresult = $db->Execute($query);
if ($dbresult && $dbresult->RowCount() > 0)
{
$row = $dbresult->FetchRow();
$comment = $row["comment"];
$this->commentForm($id, 'savecomment', '', $comment, $newsid);
}
break;
the formcase "savecomment":
if (isset($params['cancelsubmit']))
{
$this->Redirect($id, 'defaultadmin');
}
$newsid = (isset($params['newsid '])?$params['newsid ']:"");
$comment = (isset($params['comment'])?$params['comment']:"");
$query = "UPDATE ".cms_db_prefix()."module_news SET comment = ?";
$params = array($comment);
$query .= " WHERE news_id = ?";
array_push($params, $newsid);
$dbresult = $db->Execute($query, $params);
$this->Audit($id, 'produkts', 'audit');
$this->Redirect($id, 'defaultadmin');
return;
break;
Code: Select all
function commentForm($id, $moduleaction, $error='', $comment='', $newsid = '')
{
$db = $this->cms->db;
echo "<div class="adminform"";?>
<table width="100%" border="0">
<?php
echo $this->CreateFormStart($id, $moduleaction);?>
<tr>
<td style="vertical-align:top;">Info:</td>
<td><?php echo $this->CreateTextarea(true, $id, $comment, 'comment', 'syntaxHighlight', 'comment') ?>
</td>
</tr></table>
<?php echo $this->CreateInputHidden($id, 'newsid', $newsid);?>
<?php echo $this->CreateInputSubmit($id, 'submit', 'Submit') ?>
<?php echo $this->CreateInputSubmit($id, 'cancelsubmit', 'Cancel') ?>
<?php echo $this->CreateFormEnd();
echo "</div>";
}
Kris
ps taken from produkts