jQuery's Quick Comment Hack for News Module



2008-12-13

jQuery's Quick Comment Hack allow your site's visitors to post comments from article page directly.

Quick comment box will display at the bottom of the article instead of Post Comment button.
Installation:1. Download jquery.js file ( click here ), then upload it to modules/news/js folder.

2. Add this line to your theme.html between <head> and </head>:

<script type="text/javascript" src="<{$xoops_url}>/modules/news/js/jquery-1.2.6.min.js"></script>


3. edit modules/news/templates/news_article.hml and replace:

<div style="text-align: center; padding: 3px; margin:3px;">
<{$commentsnav}>
<{$lang_notice}>
</div>


with:

<script>
$(document).ready(function() {
$.get("comment_new.php?com_itemid=<{$story.id}>", function(data){
$('#quickcomment').append(data.substring(data.indexOf("<form name='commentform'"),data.indexOf("<!-- End Form Vaidation JavaScript //-->")));
});
});
</script>

<div id="quickcomment" style="text-align: center; padding: 3px; margin:3px;"><{$lang_notice}></div>


Don't forget to turn on Check templates for modifications via General Settings.
Demo: click here

Postar um comentário