November Happy Hour will be moved to Thursday December 5th.

Custom Content

Vote:
 

Following this article I implemented some similar functionality. 

http://jondjones.com/how-to-display-non-episerver-content-within-the-episerver-editor/

But I don't get the comments to show up under  "For this page". However, if I add I can see the comments under "For this page" -> (A folder named same as page) They are there. But they do not automagically appear as described in the article if I leave roots with an empty enumerable.

What am I missing?

        public override IEnumerable Roots
        {
            get
            {
                return new List { SiteDefinition.Current.ContentAssetsRoot };
            }
        }


Thanks in advance!

#145251
Mar 01, 2016 8:46
Vote:
 

Roots tells you where you can create comments. What happens if you leave it as empty IEnumerable and then add comment as you would add a local image in page files?

#145256
Mar 01, 2016 9:38
Vote:
 

Thats the problem. :-)
It displays nothing if I leave it as an empty enumerable. But according to article. It should automatically show "For this page"-folder and list comments therein. I've followed the article but it does not show any content unless I set Roots to ContentAssetsFolder. But setting this is not what I want. I want it to just show the comments for the specific  page I am looking at. 

#145261
Mar 01, 2016 10:20
Vote:
 

I'm wondering if you are creating the comments at the right place. How do you create them? Programmatically or by clicking in edit? Are you creating them in the local page files folder or in root for assets?

#145266
Mar 01, 2016 11:59
Vote:
 
                    PageData page = _contentRepo.Get<PageData>(new ContentReference(comment.PageId));
                    ContentAssetFolder assetFolder = _contentAssetHelper.GetOrCreateAssetFolder(page.ContentLink);
    
                    Comment save_comment = _contentRepo.GetDefault<Comment>(assetFolder.ContentLink);
                    save_comment.UserComment = new XhtmlString(comment.Text);
                    
                    save_comment.CommentParentLink = (comment.ParentId.HasValue) ? new ContentReference(comment.ParentId.Value) : ContentReference.EmptyReference;
                    save_comment.CommentUserName = EPiServerProfile.Current.UserName;
                    save_comment.Name = "Comment_" + EPiServerProfile.Current.UserName.Replace(" ", "") + "(" + DateTime.Now.ToShortDateString() + ")";
                    _contentRepo.Save(save_comment, SaveAction.Publish, AccessLevel.NoAccess);

comment.PageId = ID for the page on which the comment is posted. 

It places it in some folder connected to the page atleast. 

If I set Roots to ;

SiteDefinition.Current.ContentAssetsRoot

I can browse the comments under Folder




#145283
Mar 01, 2016 15:08
Vote:
 

That code looks sound. Uploading images to local page folder works as expected? They end up in "for this page folder?". Just so there isn't any configuration error...

#145300
Mar 01, 2016 16:32
Vote:
 

I have no problem uploading images to "For this Page" -folder. I'm running version 9.6.1

#145326
Mar 02, 2016 8:07
* 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.