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.
PHPopen the index.php file of your module and insert this code:
le="color: #000000"><?php //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:
le="color: #000000"><?php http://mysite/modules/myModule/index.php?mid=8
In this case you could write your comment code as this:
le="color: #000000"><?php //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:
le="color: #000000"><?php // 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'); }
SMARTYNow the smarty part. Open your smarty template and place this code at the bottom:
le="color: #000000"><?php <!-- 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?