Get XOOPS XOOPSXOOPS FAQFAQ ForumsForums NewsNews ThemesThemes ModulesModules
New Posts New Topics All Posts All Forums Index General Modules Themes Development International XOOPS.org

Search

Donat-O-Meter

Make donations with PayPal!
Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $65.00
Net Balance: $61.80
Left to go: $38.20

Donations
studioC  ($25)May-17
Anonymous ($15)May-16
Anonymous ($25)May-4

Learn XOOPS Core

Local Support

Advertisement

XOOPS Code hosted on SourceForge

Cumulus Tag Cloud

2 2.5 2.6 3.0 90 2013 Abuse admin AntiHarvesting AntiMalUser AntiSpam API Beats billige black Blocks blue Captcha cell Checksum Christmas chronolabs content Conversion demo docek download Dresses EC2 editor ELB evden eve facebook floor free games herre Honeypot Human IP jQuery kantor klubovi lamps log logger Marquee mobile module modules Monster MyAlbum-p newbb news newsletter online oxygen PageRank Payment Permissions pink Plugin portal Prevention profile project Protector Protocols publisher Rights rmcommon Room sale security Server site Smarty Spam stem Studio support tag tags tdmcreate Theme themes txmod Umfrage upgrade User userlog website Whitepaper WSDL xoops XOOPS2 Xortify XPayment ZendFramework

New Users

Registering user

# 136024

ngochuyen

Welcome to XOOPS!




Bottom   Previous Topic   Next Topic  Register To Post

(1) 2 »


#1 Posted on: 2010/4/22 12:34 Tutorial: Add rmcommon comments to your modules
First a word of caution:
rmcommon is in alfa and should NOT be used in a production site. This tutorial is just for testing.

With that said, let's get to the tutorial.

There are 2 parts; one goes into your php file and another into your smarty template. Let's start with the php part.

PHP
open the index.php file of your module and insert this code:
//get all comments for this article/item
    
RMFunctions::get_comments('tutorial','post='.$post);
    
// Comments form
    
RMFunctions::comments_form('tutorial''post='.$post'module''');


The first line gets all comments for this item. It's a function that needs 2 vars:
'tutorial' -> this is the name of your module
'post='.$post -> this is the ID of the item. Look at the url for your module. you will probably have something like this:
http://mysite/modules/myModule/index.php?mid=8

In this case you could write your comment code as this:
//get all comments for this article/item
    
RMFunctions::get_comments('myModule','post='.$_GET['mid']);
    
// Comments form
    
RMFunctions::comments_form('myModule''post='.$_GET['mid'], 'module''');


Mind you this isn't the original code from mywords. If you want to further study this, here it is:
// Comments
// When use the common utilities comments system you can choose between
// use of Common Utilities templates or use your own templates
// We will use MyWords included templates
if ($post->getVar('comstatus')){
    
RMFunctions::get_comments('mywords','post='.$post->id());
    
// Comments form
    
RMFunctions::comments_form('mywords''post='.$post->id(), 'module'MW_PATH.'/class/mywordscontroller.php');
}


SMARTY
Now the smarty part. Open your smarty template and place this code at the bottom:
<!-- Start Comments -->
<
a name="comments"></a>
<{include 
file="db:rmc_comments_display.html"}>
<{include 
file="db:rmc_comments_form.html"}>
<!-- /
End comments -->


That's it! Simple don't you think?

Top


www.kaotik.biz
kaotik
Just can't stay away
Just can't stay away
Joined:
2004/2/18 21:32
Group:
Registered Users
Posts: 751
(Show More) (Show Less)


#2 Posted on: 2010/4/22 14:19 Re: Tutorial: Add rmcommon comments to your modules
thanks, kaotik! do i have to install those two modules to get comments working? also maybe any demo?

Top


Mind anchors
deka87
Friend of XOOPS
Friend of XOOPS
Joined:
2007/10/5 13:50
From Russia
Group:
Registered Users
Posts: 1107
(Show More) (Show Less)


#3 Posted on: 2010/4/22 17:34 Re: Tutorial: Add rmcommon comments to your modules
Great, I must try it! Tnx!

Top


Docek Nove godine 2014
Drug rehab help
Car owners manuals - Car advices
bjuti
Just can't stay away
Just can't stay away
Joined:
2009/1/7 17:55
From Belgrade, Serbia
Group:
Registered Users
Posts: 858
(Show More) (Show Less)


#4 Posted on: 2010/4/23 3:31 Re: Tutorial: Add rmcommon comments to your modules
deka87: you only need rmcommon. A demo sounds like a good ideia.

Top


www.kaotik.biz
kaotik
Just can't stay away
Just can't stay away
Joined:
2004/2/18 21:32
Group:
Registered Users
Posts: 751
(Show More) (Show Less)


#5 Posted on: 2010/4/23 13:31 Re: Tutorial: Add rmcommon comments to your modules
Yeah a demo our some final screenshots would be great what we can expect of this hack.

Cheers!

Top

acegamer
Not too shy to talk
Not too shy to talk
Joined:
2005/7/11 9:39
Group:
Registered Users
Posts: 162
(Show More) (Show Less)


#6 Posted on: 2010/4/26 13:08 Re: Tutorial: Add rmcommon comments to your modules
you can now visit my site, go to tutorials section and add comments :)
www.kaotik.biz


Top


www.kaotik.biz
kaotik
Just can't stay away
Just can't stay away
Joined:
2004/2/18 21:32
Group:
Registered Users
Posts: 751
(Show More) (Show Less)


#7 Posted on: 2010/4/27 5:58 Re: Tutorial: Add rmcommon comments to your modules
Thanks kaotik



Top

sarahmx
Quite a regular
Quite a regular
Joined:
2007/10/28 6:06
Group:
Registered Users
Posts: 352
(Show More) (Show Less)


#8 Posted on: 2010/4/27 8:25 Re: Tutorial: Add rmcommon comments to your modules
Great, tnx! :D

Top


Docek Nove godine 2014
Drug rehab help
Car owners manuals - Car advices
bjuti
Just can't stay away
Just can't stay away
Joined:
2009/1/7 17:55
From Belgrade, Serbia
Group:
Registered Users
Posts: 858
(Show More) (Show Less)


#9 Posted on: 2010/5/3 20:16 Re: Tutorial: Add rmcommon comments to your modules
1. what happened if you are a logged in as a registered user..do we have to input the name/email/website field ?


if no, is the username in the comment linked to xoops standard profile ?


2. how to disable email/website input

Top

demian
Quite a regular
Quite a regular
Joined:
2008/4/29 0:06
Group:
Registered Users
Posts: 225
(Show More) (Show Less)


#10 Posted on: 2010/5/4 5:39 Re: Tutorial: Add rmcommon comments to your modules
demian: No, just the text field. Yes it's then linked to your username.
Website isn't mandatory. However you can't disable email (for anonymous users) otherwise you will have other problems, such as an anonymous user using someone else name. The email is kept confidential and is used by rmcommon as a salt to verify the name against it's email......I think....

Top


www.kaotik.biz
kaotik
Just can't stay away
Just can't stay away
Joined:
2004/2/18 21:32
Group:
Registered Users
Posts: 751
(Show More) (Show Less)




(1) 2 »



You can view topic.
You cannot start a new topic.
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You can vote in polls.
You cannot attach files to posts.
You cannot post without approval.
You cannot use topic type.
You cannot use HTML syntax.
You cannot use signature.

[Advanced Search]