Jeff Wallace
Feb 16, 2011
  4160
(3 votes)

Page Rating Dynamic Content Module

Based on CMS 6

Back in January Paul Smith blogged about a pretty cool Page Rating Dynamic Content widget he built using Page Objects.  I found this to be pretty useful for demonstrating the concept of basic rating in EPiServer CMS.  After all, some things are better to show than to say “sure you could add that, it’s easy”.  The code you will find in that blog was based on RC1 and the actual release had a few breaking changes which needed to be fixed for this to work.  As a result I’ve hijacked Paul’s code, updated it, and uploaded it here.  I also used a different star image for the rating system that I felt worked better within the Alloy Technologies templates.  Paul’s looked a little too Captain America(ish) for my taste but I know it’s because he loves Americans and American English!  Winking smile  Of course, you can swap this out with any image you choose by placing your preferred image in the Images folder with the correct name.  Note, with my update all page versions and languages of the page will share the rating.  If you prefer a different approach this is changeable in the RatingControl.ascx.cs code by modifying the third parameter to pom.Save().

 

The configurable Dynamic Content widget looks as follows:

image

And the resulting page:

image

 

I have included a Visual Studio project which will auto-magically copy the necessary files to the expected locations *if* you place the core “Rating” folder in the code download in the root directory of your EPiServer site, add it to your main solution, and Build the project.  Additionally you will need to add the line highlighted in yellow below to the <dynamicContent> section of episerver.config:

 

<dynamicContent>
  <controls>
<add description="Displays a Rating facility" name="Rating"
type="EPiServer.Samples.RatingDC, Rating" />
    …
  </controls>
</dynamicContent>
 

Enjoy!

Feb 16, 2011

Comments

Anders Hattestad
Anders Hattestad Feb 16, 2011 11:55 PM

Like the icons, but you can rate any number of times.. Thats a small drawback :(

Feb 21, 2011 08:58 PM

Hi Anders. Thanks for the feedback. You are correct, anyone can rate the item any number of times. Many customers will want a single rating tied to a user and require that the user be logged in before enabling the rating feature. The idea here is just an example of how easy it is to add something like this in EPiServer. This should be solid for *basic* demos and also a good starting point for someone who wants to expand the capability with functionality such as that listed previously, configurable items such as star rating vs. thumbs up/down, etc. Maybe this will come in a future blog post? :)

Anyway, thanks again for the feedback.

Please login to comment.
Latest blogs
Opti ID overview

Opti ID allows you to log in once and switch between Optimizely products using Okta, Entra ID, or a local account. You can also manage all your use...

K Khan | Jul 26, 2024

Getting Started with Optimizely SaaS using Next.js Starter App - Extend a component - Part 3

This is the final part of our Optimizely SaaS CMS proof-of-concept (POC) blog series. In this post, we'll dive into extending a component within th...

Raghavendra Murthy | Jul 23, 2024 | Syndicated blog

Optimizely Graph – Faceting with Geta Categories

Overview As Optimizely Graph (and Content Cloud SaaS) makes its global debut, it is known that there are going to be some bugs and quirks. One of t...

Eric Markson | Jul 22, 2024 | Syndicated blog

Integration Bynder (DAM) with Optimizely

Bynder is a comprehensive digital asset management (DAM) platform that enables businesses to efficiently manage, store, organize, and share their...

Sanjay Kumar | Jul 22, 2024

Frontend Hosting for SaaS CMS Solutions

Introduction Now that CMS SaaS Core has gone into general availability, it is a good time to start discussing where to host the head. SaaS Core is...

Minesh Shah (Netcel) | Jul 20, 2024

Optimizely London Dev Meetup 11th July 2024

On 11th July 2024 in London Niteco and Netcel along with Optimizely ran the London Developer meetup. There was an great agenda of talks that we put...

Scott Reed | Jul 19, 2024