Jump to content

Comments system - stars and up/down votes


encho
 Share

Recommended Posts

Hi all, help needed with comments here. I see that there is a star rating system and possibility to upvote or downvote specific comments. Page on comments still does not go into details, especially about displaying them. I followed other things on that page, including the styling, to the letter. If you include custom code {stars}, stars are displayed but not properly (it shows 5 star only regardless of the rating). Also {votes} does show the arrows but they do not do anything. While in the backend things do work as expected (ie. stars can be set and votes changed). Am I missing something, like custom JavaScript or similar? Anyone else using these features in their comments?

Link to comment
Share on other sites

1 minute ago, Zeka said:

Hi @encho

I've never used this module, but as far as I see there are comments.js and comments.css which you have to include on your page.

Here is repo of this module https://github.com/processwire/processwire/tree/dev/wire/modules/Fieldtype/FieldtypeComments

Hope it helps.

Thanks, good point. Already used css from their page, but that js might do the trick I hope.

Link to comment
Share on other sites

  • 6 months later...

Hi encho and Zeka and everybody else who reads my posting. I have the same problem like encho: The comments function works well, but If you include custom code {stars}, stars are displayed but not correctly. It shows 5 star only regardless of the rating.  I am using this code:

<?php echo $page->comments->render(array(
			'headline' => '<h3>Comments</h3>',
			'commentHeader' => 'Posted by {cite} on {created}{stars}{votes}',
			'dateFormat' => 'd.m.Y H:i:s',
			'encoding' => 'UTF-8',
			'admin' => false, // shows unapproved comments if true
		));

In the attached screenshot you can see the result.

Does anyone have any idea how to get the Star Rating function to work correctly?

star-rating-problem.png

Link to comment
Share on other sites

Hello,

I had used comments fieldtype and it works perfect.
Just right now compared what I had used and there are few differences, but first please check did you have on page Comments css and js files:

<link rel="stylesheet" type="text/css" href="<?php echo $config->urls->FieldtypeComments;?>comments.css" />
<script type='text/javascript' src='<?php echo $config->urls->FieldtypeComments;?>comments.min.js'></script>

And call:

<?php echo $page->comments->render(array(
			'headline' => '',
			'commentHeader' => '<span class="comment-by">{cite}
									<span class="date">{created}</span>
									{stars}{votes}
								</span>',
			'useVotes' => 1,
			'useStars' => 1,
			'upvoteFormat' => '<span class="rate-review"><i class="sl sl-icon-like"></i> Helpful Review {cnt}</span>',
			'downvoteFormat' => '<span class="rate-review"><i class="sl sl-icon-dislike"></i> Dislike Review {cnt}</span>'
				));?>

Please check and Comments settings inside admin where you can define stars rating (need to fill form or not).

Regards.

  • Like 1
  • Thanks 2
Link to comment
Share on other sites

Hello, Zeka,

thank you, that was the right assumption. Being a PHP dilettante, I didn't know how to get the stylesheet for the comments module correctly. I finally tried the following code:

		<!-- Anfang Kommentar- und Page-Rating-Formular -->
		<link rel="stylesheet" href="/wire/modules/Fieldtype/FieldtypeComments/comments.css">
		<?php echo $page->comments->renderAll(); ?>
		<!-- Ende Kommentar- und Page-Rating-Formular -->

And now the star rating function works as it should (see screenshot in the attachment).

Thank you and best greetings to Kiev!

Hajosch

star-rating-loesung.png

Link to comment
Share on other sites

Hi OLSA,

thanks. Also your solution to call the Comments css and js files is working fine - and the result looks good! I'm becoming more and more a real fan of ProcessWire and its helpful user community.

Hajosch

 

 

 

Link to comment
Share on other sites

  • 3 weeks later...

Hi guys, If I use : 

<link rel='stylesheet' type='text/css' href='<?=$config->urls->FieldtypeComments?>comments.css' />
<script type='text/javascript' src="<?= $config->urls->FieldtypeComments?>comments.min.js"></script>
<?php echo $page->comments->renderAll(); ?> 

The comment work, but:

  • I can't see the star system in the form and in the comment, also if I add it in the backend.
  • The up and down vote don't working well, when I add a vote I see the number grow but after reload the page the vote disappear and (correctly) I can't make a new vote.

I try also to customizing the comments output to force the system but this doesn't work.

Some one know what I can try to do?

Thank you.

 

Link to comment
Share on other sites

  • 1 year later...

Same issue here  :

I have used 

 <link rel="stylesheet" type="text/css" href="<?php echo $config->urls->FieldtypeComments?>comments.css" />
<script type="text/javascript" src="<?php echo $config->urls->FieldtypeComments?>comments.min.js"></script>

as code and ensured the links are working, the css and js are loaded but my comment forms are not showing any star input

1938711583_commentlassRoom.thumb.png.88a6710b05f1eab6ecdcfd901f0d2a1a.png

 

any help pls ? 

 

 

Link to comment
Share on other sites

  • 5 weeks later...

I updated to the below version and the comment system module is showing the star input / output. But I have another doubt, how do I add an extra field in the comment form ? 

 ProcessWire 3.0.162 dev © 2020 

 

Link to comment
Share on other sites

1 hour ago, JeevanisM said:

I updated to the below version and the comment system module is showing the star input / output. But I have another doubt, how do I add an extra field in the comment form ? 


 ProcessWire 3.0.162 dev © 2020 

 

Moderator note:

@JeevanisM, please keep the same question in one place. Thank you.

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

×
×
  • Create New...