jQuery's Quick Comment Hack for News Module

Date 2008/12/13 22:50:00 | Topic: Hacks

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




This article comes from XOOPS Web Application System
https://xoops.org

The URL for this story is:
https://xoops.org/modules/news/article.php?storyid=4569