Website Comments - getRecords

4 posts by 2 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: May 28, 2012   (RSS)

By Perchpole - May 26, 2012

Hello, All -

I've just set-up Website Comments on my system and I really very impressed with what it can do! I think I've got everything in place but I just wanted to know a couple of things...

Can I run a getRecords call to list the comments? Currently I'm using a MySQL query to pull in the comments but I need to JOIN this with the cms_accounts table to get the userNames, etc.

When I look at the new WSC tables via phpMyAdmin they appear to be nested inside a table called CMS. Is this normal?

I also notice there is a double underscore in the table names, eg:

cms__wsc_comments

Again, is this normal?

Otherwise, money well spent on a fantastic plugin!

:0)

Perchpole

Re: [Dave] Website Comments - getRecords

By Perchpole - May 27, 2012

Hi, Dave -

Thanks for your note. My main reason for asking this question is because I want to feed a couple of comments on to the front page of the site. These will form a bit of interest in the page footer under the heading of "Latest Comments..."

After reading your suggestions I've done this...

<?php
// load comments
list($quickcomments) = getRecords(array(
'tableName' => '_wsc_comments',
'orderBy' => ($GLOBALS['WSC_SORT_ORDER'] == 'newest') ? 'createdDate DESC' : 'createdDate',
'limit' => '2',
'allowSearch' => false,
));
?>


I've stripped out some the erroneous code and it seems to work ok!

On the page I've inserted the following loop where the comments appear...

<?php foreach ($quickcomments as $qcomment): ?>
<?php $commentRec = mysql_get('record', $qcomment['recordNum']); ?>
<?php $commentCat = mysql_get('category', $commentRec['category']); ?>
comments here...
<a href="./index.php?cat=<?php echo $commentCat['num'] ?>&rec=<?php echo $qcomment['recordNum'] ?>">Link...</a>
<?php endforeach ?>


Again, what a great little plugin. It has added an entirely new dimension to my latest project.

:0)

Perch

Re: [Perchpole] Website Comments - getRecords

By Dave - May 28, 2012

Great, glad to hear you've got it working that way you need. :)
Dave Edis - Senior Developer
interactivetools.com