Diskordier
Neu angemeldet
- Registriert
- 14 Juli 2013
- Beiträge
- 161
Ich hab das zwar schon bei einem anderen Post angeschnitten, jedoch möchte ich doch einen neuen Post eröffnen da es beim alten Post ursprünglich um was anderes ging , ich hoffe das ist Okay so ?
Wie gesagt ich möchte zu einer bestehenden Kommentarfunktion eine Button einbauen wo ein user auf einen schon bestehenden Kommentar antworten kann.
Aber irgendwie werde ich nicht ganz schlau daraus wie ich das anstelle.
Wenn ich die db so erstelle kann ich immer nur einem subcommentschreiben ich muss ja wissen das der subcomment zu folgender Commentid gehört und die kann ich ja nicht mehrmals verwenden da die ja automatisch immer hochgezählt wird.
Bis jetzt sieht es so aus, mir ist noch nicht klar wie ich mehrere sub comments erstellen kann ohne die commentid zu manipulieren, so kann ich höchstens eine machen.
Wie ich es Grafisch umsetze ist mir auch noch nicht ganz klar aber das ers tmal nicht so wichtig
[src=html5]foreach($comments as $comment){ ?>
<article id="comment-<?=$comment['commentID']?>">
<section class="meta border-red">
<?=include_avatar($comment)?>
<span class="author"><?=$comment['username']?></span>
<time datetime="<?=date('c', strtotime($comment['dateCreated']))?>"><?=date(DATE_HUMAN, strtotime($comment['dateCreated']))?></time>
</section>
<section class="message">
<div class="inset-shadow">
<div class="super-bar border-red"></div>
<p>
<?=bbc2html(nl2br($comment['message']), 'url')?>
</p>
<!--Antwortbutton-->
<a class="acp-link" href="<?=WEB_ROOT?>index.php?site=comment&action=subcomment&animeid=<?=$animeID?>&commentid=<?=$comment['commentID']?>">[Auf Kommentar Antwort]</a>[/src]
[src=php]/SUBcomment erstelllen
case 'subcomment':
$h2title = ' Auf Kommentar Antworten';
$submitvalue = 'Bearbeiten!';
$row = $_POST;
//Subcomment eintragen
case 'Subcomment update':
$message = htmlspecialchars($_POST['form-message']);
$fields = '`userID`, `animeID`, `subcommentid`, `submessage`';
$values = "$userID, $animeID, $subcommentid 1+COUNT, ";
//todo insert into subcomment
$qry = $sql->prepare("Update `anmi1_comment `commentid`($fields) VALUES($values)");
$qry->bindValue('m', $message, PDO::PARAM_STR);
$qry->execute();
$h2title = 'Inserting';
header("refresh: ".FORWARD_TIME."; index.php?site=streams&animeid=$animeID");
$message = '<h3>Eintrag erfolgreich!</h3><p class="message"><a href="'.WEB_ROOT.'index.php?site=streams&animeid='.$animeID.'">Du wirst in '.FORWARD_TIME.' Sekunden weitergeleitet...</a></p>';
break;[/src]
[src=html5]<div class="wrapper">
<div id="comment-container" class="<?=($isAjax == True) ? 'ajax' : ''?>">
<h2><?=$h2title?></h2>
<?php
if(isset($submitvalue)){
?>
<form id="comment-form" method="POST" action="index.php?site=comment&action=update&animeid=<?=$animeID?>">
<label for="form-message">Kommentar</label>
<br>
<textarea id="form-message" name="form-message" placeholder="Deine Nachricht"><?=@$row['form-message']?></textarea>
<br>
<input type="submit" value="<?=$submitvalue?>">
</form>
<?php
} else {
echo "$message";
}
?>
</div>
</div>[/src]
Achtung der Code ist noch nciht fertg also nicht das der bei euch nun Fehlerfrei ist.
Wie gesagt ich möchte zu einer bestehenden Kommentarfunktion eine Button einbauen wo ein user auf einen schon bestehenden Kommentar antworten kann.
Aber irgendwie werde ich nicht ganz schlau daraus wie ich das anstelle.
Wenn ich die db so erstelle kann ich immer nur einem subcommentschreiben ich muss ja wissen das der subcomment zu folgender Commentid gehört und die kann ich ja nicht mehrmals verwenden da die ja automatisch immer hochgezählt wird.
Bis jetzt sieht es so aus, mir ist noch nicht klar wie ich mehrere sub comments erstellen kann ohne die commentid zu manipulieren, so kann ich höchstens eine machen.
Wie ich es Grafisch umsetze ist mir auch noch nicht ganz klar aber das ers tmal nicht so wichtig
[src=html5]foreach($comments as $comment){ ?>
<article id="comment-<?=$comment['commentID']?>">
<section class="meta border-red">
<?=include_avatar($comment)?>
<span class="author"><?=$comment['username']?></span>
<time datetime="<?=date('c', strtotime($comment['dateCreated']))?>"><?=date(DATE_HUMAN, strtotime($comment['dateCreated']))?></time>
</section>
<section class="message">
<div class="inset-shadow">
<div class="super-bar border-red"></div>
<p>
<?=bbc2html(nl2br($comment['message']), 'url')?>
</p>
<!--Antwortbutton-->
<a class="acp-link" href="<?=WEB_ROOT?>index.php?site=comment&action=subcomment&animeid=<?=$animeID?>&commentid=<?=$comment['commentID']?>">[Auf Kommentar Antwort]</a>[/src]
[src=php]/SUBcomment erstelllen
case 'subcomment':
$h2title = ' Auf Kommentar Antworten';
$submitvalue = 'Bearbeiten!';
$row = $_POST;
//Subcomment eintragen
case 'Subcomment update':
$message = htmlspecialchars($_POST['form-message']);
$fields = '`userID`, `animeID`, `subcommentid`, `submessage`';
$values = "$userID, $animeID, $subcommentid 1+COUNT, ";
//todo insert into subcomment
$qry = $sql->prepare("Update `anmi1_comment `commentid`($fields) VALUES($values)");
$qry->bindValue('m', $message, PDO::PARAM_STR);
$qry->execute();
$h2title = 'Inserting';
header("refresh: ".FORWARD_TIME."; index.php?site=streams&animeid=$animeID");
$message = '<h3>Eintrag erfolgreich!</h3><p class="message"><a href="'.WEB_ROOT.'index.php?site=streams&animeid='.$animeID.'">Du wirst in '.FORWARD_TIME.' Sekunden weitergeleitet...</a></p>';
break;[/src]
[src=html5]<div class="wrapper">
<div id="comment-container" class="<?=($isAjax == True) ? 'ajax' : ''?>">
<h2><?=$h2title?></h2>
<?php
if(isset($submitvalue)){
?>
<form id="comment-form" method="POST" action="index.php?site=comment&action=update&animeid=<?=$animeID?>">
<label for="form-message">Kommentar</label>
<br>
<textarea id="form-message" name="form-message" placeholder="Deine Nachricht"><?=@$row['form-message']?></textarea>
<br>
<input type="submit" value="<?=$submitvalue?>">
</form>
<?php
} else {
echo "$message";
}
?>
</div>
</div>[/src]
Achtung der Code ist noch nciht fertg also nicht das der bei euch nun Fehlerfrei ist.