1
kaotik
Tutorial: Add rmcommon comments to your modules
  • 2010/4/22 17:34

  • kaotik

  • Just can't stay away

  • Posts: 861

  • Since: 2004/2/19


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:

<
a name="comments">a>
<{include 
file="db:rmc_comments_display.html"}>
<{include 
file="db:rmc_comments_form.html"}>


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

2
deka87
Re: Tutorial: Add rmcommon comments to your modules
  • 2010/4/22 19:19

  • deka87

  • Friend of XOOPS

  • Posts: 1125

  • Since: 2007/10/5


thanks, kaotik! do i have to install those two modules to get comments working? also maybe any demo?
Mind anchors

3
bjuti
Re: Tutorial: Add rmcommon comments to your modules
  • 2010/4/22 22:34

  • bjuti

  • Just can't stay away

  • Posts: 871

  • Since: 2009/1/7 2


Great, I must try it! Tnx!

4
kaotik
Re: Tutorial: Add rmcommon comments to your modules
  • 2010/4/23 8:31

  • kaotik

  • Just can't stay away

  • Posts: 861

  • Since: 2004/2/19


deka87: you only need rmcommon. A demo sounds like a good ideia.

5
acegamer
Re: Tutorial: Add rmcommon comments to your modules
  • 2010/4/23 18:31

  • acegamer

  • Not too shy to talk

  • Posts: 162

  • Since: 2005/7/11


Yeah a demo our some final screenshots would be great what we can expect of this hack.

Cheers!

6
kaotik
Re: Tutorial: Add rmcommon comments to your modules
  • 2010/4/26 18:08

  • kaotik

  • Just can't stay away

  • Posts: 861

  • Since: 2004/2/19


you can now visit my site, go to tutorials section and add comments :)
http://www.kaotik.biz

7
sarahmx
Re: Tutorial: Add rmcommon comments to your modules
  • 2010/4/27 10:58

  • sarahmx

  • Quite a regular

  • Posts: 381

  • Since: 2007/10/28


Thanks kaotik


8
bjuti
Re: Tutorial: Add rmcommon comments to your modules
  • 2010/4/27 13:25

  • bjuti

  • Just can't stay away

  • Posts: 871

  • Since: 2009/1/7 2


Great, tnx!

9
demian
Re: Tutorial: Add rmcommon comments to your modules
  • 2010/5/4 1:16

  • demian

  • Quite a regular

  • Posts: 225

  • Since: 2008/4/29


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

10
kaotik
Re: Tutorial: Add rmcommon comments to your modules
  • 2010/5/4 10:39

  • kaotik

  • Just can't stay away

  • Posts: 861

  • Since: 2004/2/19


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....

Login

Who's Online

194 user(s) are online (115 user(s) are browsing Support Forums)


Members: 0


Guests: 194


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits