Jump to content

If no comments, display a message


ZionBludd
 Share

Recommended Posts

I'm using the comments module as the basis for a simple reviews system. Pretty basic at the moment...

I'm having issues getting it to display a "No reviews found message"

Here is my existing code:

<? 
// if ($page->enable_reviews)
$limit = 10; 
$start = ($input->pageNum-1) * $limit; 
// Status 1 means approved
$selector = "page=$page, status=1, sort=-created, start=$start, limit=" . ($limit+1); 

// find the comments. replace "comments" with the name of your comments field
$comments = FieldtypeComments::findComments("reviews", $selector); 

// output the comments
//if ($comments->status = 1)
  echo $comments->render(array('headline' => '<h4><i class="fa fa-star"></i> Reviews</h4>',
  ));

// output the pagination links
if($input->pageNum > 1) echo "<a href='./page" . ($input->pageNum-1) . "'>Back</a> ";
if(count($comments) > $limit) echo "<a href='./page" . ($input->pageNum+1) . "'>Next</a>";
if ($selector->status ==0) ; echo "Test";
?> 

I've tried if ($page->$reviews >1) then display, but doesn't seem to work... .

Anyone using the comment module have any idea on how to get this to work?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...