SaaS CMS has officially launched! Learn more now.

Comments on pages


Which would be the best way to add comment functionallity on CMS page types? I have found so many different answers i don't really know which to use. I can't get a grip on the CommentHandler-class and how to reference a Entity for a page...

Sep 07, 2011 14:59

You need an entity corresponding to the page. Previously there was the open source PageEntity, and now Relate 2 R2 seems to have it (or something similar) built-in, see "Social Pages" in this article:

Sep 07, 2011 16:06

Have you looked at this yet Jonas? 

Sep 07, 2011 16:11

I looked at the Pageentity-project, the code i found seemed te only support the Wiki and not CMS-Pages. Maybe i didn't look hard enought :). Creating an Entity sounds like the best way... building a comment system in CMS isn't that hard, but i want to use Relate+.

Does anybody know of a good article describing how to implement PageEntity with CMS pages?

Sep 08, 2011 13:54

I'm not sure if things are going forward or backwards for me right now, but i'm sure struggling.... I created a PageEntity called CMSPageEntity and tried to add a Tag to it using this code:

CMSPageEntity x = (CMSPageEntity)new CMSPageEntity(CurrentPage.PageGuid).Clone();
UserAuthor user = new UserAuthor(CommunitySystem.CurrentContext.DefaultSecurity.CurrentUser);
Tag tag = new Tag("Testtagg");
ICategory cat = new Category("testcat");
x.EntityTags.Add(new EntityTag(tag, cat, user));


It results in this exception, what do i miss here?


The specified object of type 'EPiServer.Templates.RelatePlus.Templates.PageEntity.CMSPageEntity' in argument named 'pageEntity' is not committed to the database and cannot be used as an input parameter.


Sep 09, 2011 8:02

You have to use PageEntityHandler.AddPageEntity when you're creating a new entity.

Sep 09, 2011 8:08

Ok, so finally i got this to work. First i created a custom PageEntity, constructed som logic to handle the creation (or use) of it and som other basic stuff. The creation of comments works fine, but now i struggle getting the comments instead... i need to get all comments for a specific PageEntity, so i have two options: GetComments or GetQueryResult. GetComments should be the way, but it takes an IAuthor as parameter. I don't want to filter by author, is there a way to do this? GetQueryResult is more flexibel, but i cannot find any parameter to filter by "Commented Entity"...

Sep 13, 2011 8:30

Passing null for author should get you all comments regardless of author.

Sep 13, 2011 8:39
This thread is locked and should be used for reference only. Please use the Legacy add-ons forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.