source code:
javascript
$('.resposta').click(function(){
var id = $(this).children('input').val();
alert(id);
$(this).fadeOut("fast");
$(this).parents('.coment').find('.resp').fadeIn("slow");
$('form[name="responder"]').submit(function(){
return false;
});
return false;
});
page php where already displays the 5 comments
<?php
/*
**********************************************
**********************************************
***********Função para exibição dos***********
****************comentarios*******************
**********************************************/
$comentar = new Read;
$comentar ->ExeRead('coment', 'WHERE video = :video ORDER BY id DESC LIMIT 5', "video={$sei[1]}");
foreach ($comentar->getResult() as $big):
extract($big);
$image = new Read;
$image ->ExeRead('users', 'WHERE id = :id', "id={$big['user']}");
foreach ($image->getResult() as $imx)
extract ($imx);
/*
**********************************************
**********************************************
*********Fim da função de exibição************
***************de comentarios*****************
**********************************************/
echo "<input type='text' hidden='hidden' value='{$link}' id='link'>";
?>
<div class='comentar fl-left'>
<div class='coment com' >
<?php
if($foto == "" || $foto == "uploads/"):
echo "<a href='user?id={$id}'><img class='fl-left' src='".REQUIRE_PATH."/css/boot/icons/thumb.png'></a>";
else:
echo "<a href='user?id={$id}'><img class='fl-left' src='{$imx['foto']}'></a>";
endif;
?>
<p><small class='fontze1'>Comentado por:</small> <?=$nome?> <small>Em: </small> <?=$date?> <small>As: </small> <?=$hora?></p>
<div class="comentando">
<p><?=nl2br($comentario)?></p></div>
<div class='fl-right resposta'>Responder<input type='hidden' value='<?=$big[id] ?>' name='idcoment'>
</div>
<div class=' resp' style='display:none'>
<form method='post'><textarea></textarea>
<input class='btn btn-green' type='submit' value='responder' name='responder'>
</form>
</div>
</div>
<?php
endforeach;
endforeach;
endforeach;
?>
<center><div id='load' class='btn btn-blue btn-full'>Mostar mais comentários</div></center> <div class='clear'></div>
</div>
page where it is puchado show more
<?php
include '../_app/Config.inc.php';
// Função do jquery para listar os comentários
if(filter_input(INPUT_POST, 'acao') == 'comentarios'){
$video = filter_input(INPUT_POST, 'video');
$numcom = filter_input(INPUT_POST, 'numcom');
$readCount = new Read ();
$readCount ->ExeRead('coment', "WHERE video = :video LIMIT $numcom,4", "video={$video}");
echo $readCount->getRowCount();
}
// Função do jquery para exibir mais comentários
if(filter_input(INPUT_POST, 'acao') == 'morecoment'){
$video = filter_input(INPUT_POST, 'video');
$numcom = filter_input(INPUT_POST, 'numcom');
$readCount = new Read ();
$readCount ->FullRead("SELECT * FROM coment WHERE video = :video ORDER BY id DESC LIMIT $numcom,3", "video={$video}" );
foreach ($readCount->getResult() as $cat):
extract($cat);
$image = new Read;
$image ->ExeRead('users', 'WHERE id = :id', "id={$cat['user']}");
foreach ($image->getResult() as $imx):
extract ($imx);
echo "<div class='coment com' style='display:none'>";
if($foto == "" || $foto == "uploads/"):
echo "<a href='user?id={$id}'><img class='fl-left' src='".REQUIRE_PATH."/css/boot/icons/thumb.png'></a>";
else:
echo "<a href='user?id={$id}'><img class='fl-left' src='{$imx['foto']}'></a>";
endif;
?>
<p><small class='fontze1'>Comentado por:</small> <?=$nome?> <small>Em: </small> <?=$date?> <small>As: </small> <?=$hora?></p>
<div class="comentando">
<p><?=nl2br($comentario)?></p></div>
<div class='fl-right resposta'>Responder<input type='hidden' value='<?=$big[id] ?>' name='idcoment'>
</div>
<div class=' resp' style='display:none'>
<form name='responder' method='post'><textarea></textarea>
<input class='btn btn-green' type='button' value='responder' name='responder'>
</form>
</div></div>
<?php
endforeach;
endforeach;
}