Hacks: jQuery's Quick Comment Hack for News Module

Posted by: AnonymousOn 2008/12/13 22:50:00 18329 reads
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 and :

<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("),data.indexOf(""))); 
    }); 
}); 
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