Catalogue rating within custom templates


#5050 (In Topic #1130)
Standard member
Joe is in the usergroup ‘Honoured member’
I have a custom display of catalogue entries within a Comcode page that use a custom set of templates (via the cc_embed block). I'm trying to display a rating block as well as details on the current rating of the entry but I'm running into some snags (again, this is a custom display of entries and is not being view from within the catalogues module).

I added the rating block into the template, like so:

This allowed me to rate the entry but it was not saved when I refreshed the page. So I gave the block a name (it names itself with the title of the catalogue entry, which is also the name of the current page being viewed), which seems to keep the rating:

A {RATING} param is passed into the templates but seems to always remain empty. Oddly though, it returns blank but not empty when I do something like this:

I was hoping to use this parameter to display the entry's overall rating (if that's even what it's intended for). Since I couldn't get it to show any value, I looked into using {$RATING}, like so:


This always returns 0. I assume the rating block is not communicating with the entry's actual rating, or maybe I'm using the wrong parameters within {$RATING}.

Also, are there any parameters I can pass into {$BLOCK} to hide the outer box styling of the main_rating block, and only show the star display + number of votes?
Online now: No Back to the top


Site director
Chris Graham is in the usergroup ‘Administrators’
Fixes in:
Various rating block fixes, and adding a new display_tpl parameter · ocproducts/composr@36efb46 · GitHub

Ignore the string_scan.php file.

I think your 'not saving' issue is due to your page names being something non-ID-like (e.g. some slightly unusual character), which the block didn't expect.

I've added a display_tpl block parameter which you can set to RATING_INLINE_DYNAMIC.

I think your catalogue is showing no rating because it doesn't have ratings enabled on the entry(ies).
And IF_NON_EMPTY will not consider something with just whitespace as empty. For that you need to do IF_NON_EMPTY,{$TRIM,...}. I think in the case of ratings the templating controls the various situations where rating is available or not, and templates will often introduce white-space.

Become a fan of Composr on Facebook or add me as a friend. Add me on on Twitter. Follow me on Minds (where I am most active). Support me on Patreon

Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about Composr whenever you see the opportunity or support me on Patreon.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying Composr on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Online now: No Back to the top
1 guest and 0 members have just viewed this.


Users online:

Paul D, Philip, Manu, gabriel58, Vaiva, John Connor, mytracker, deepu_ms, cwdean

Forum statistics:
  • 1,361 topics, 5,910 posts, 7,290 members
  • Our newest member is advanceayurveda
Back to Top