Catalogue rating within custom templates
Posted
#4729
(In Topic #953)
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?
Posted
https://github.com/ocproducts/composr/commit/36efb46970672a19470c20f65fe2b02fdb6d3138
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.
0 guests and 0 members have recently viewed this.