To bring Author and title of the page in Recent Content Widget

Topics: General
Sep 13, 2011 at 4:52 AM

Hi Friends,,

  In recent content widget i given option as commentpart in the dropdownlist..but in the front end its showing only the datetime of the commentpart but i need to show the author and title of the page.. please anybody say how to do this...please help me to solve this problem..

Thanks

selva

Coordinator
Sep 13, 2011 at 5:09 AM

The Model tab of the shape tracing tool is your friend.

Sep 13, 2011 at 5:19 AM

bertrandleroy

By using Model tab in shape tracing how can i do this..please explain me clearly..It will be helpfull for me

 

Thanks

selva

Coordinator
Sep 13, 2011 at 5:21 AM

Find what you need, copy the expression into your template.

Sep 13, 2011 at 5:27 AM

bertrandleroy,

I am new to this technology..First time i am customizing the widget..please how to find and copy the expression.

 

Thanks

selva

Coordinator
Sep 13, 2011 at 6:01 AM

You can use @Model.ContentPart.ContentItem.RoutePart.Title and @Model.ContentPart.ContentItem.CommonPart.Owner.UserName.

Sep 13, 2011 at 6:39 AM
Edited Sep 13, 2011 at 6:41 AM

bertrandleroy

Thank you for helping me this much,,but still i am getting some exception.This is my template

 


@*
    ContentPart: RecentContentWidgetPart
    ContentItems: List
*@

@{
    IEnumerable<object> contentItems = Model.ContentItems;
    Model.ContentItems.Classes.Add("content-items");
    Model.ContentItems.Classes.Add("recent-widget");
}



@Display(Model.ContentItems)
@if (contentItems == null || contentItems.Count() == 0) {
<p>@T("There are no recent content.")</p>
}

 

if i add this in my template

@Model.ContentPart.ContentItem.RoutePart.Title

@Model.ContentPart.ContentItem.CommonPart.Owner.UserName.

 

i am getting exception.. please how to solve this.

 

Thanks

selva

Coordinator
Sep 13, 2011 at 6:49 AM

What's "some exception"?

I'm totally confused. What template are you in? What did you mean by "i given option as commentpart in the dropdownlist"?

Sep 13, 2011 at 6:57 AM

bertrandleroy

 

I am using Contrib.RecentContent Widget..In the admin menu editor template there is a dropdownlist "For Content Part".If i select s commentpart in the "For Content Part" dropdownlist its showing only the datetime.

This the template for Contrib.RecentContent Widget


@*
    ContentPart: RecentContentWidgetPart
    ContentItems: List
*@

@{
    IEnumerable<object> contentItems = Model.ContentItems;
    Model.ContentItems.Classes.Add("content-items");
    Model.ContentItems.Classes.Add("recent-widget");
}



@Display(Model.ContentItems)
@if (contentItems == null || contentItems.Count() == 0) {
<p>@T("There are no recent content.")</p>
}

 

I want to display the author and page title in this template.please help me out from this problem.

Thanks

selva

Coordinator
Sep 13, 2011 at 7:06 AM

You're probably not modifying the right template. content-comment may be what you need to override. It may also be a placement problem. Did you try contacting the author of that module?

Sep 13, 2011 at 7:12 AM

bertrandleroy

Author name for the module is Sébastien Ros.How to contact him to get solution for this problem.

Thanks

selva

Coordinator
Sep 13, 2011 at 7:32 AM

There is a contact form on the gallery for each module, but I can ask him to look at this thread.

Sep 13, 2011 at 8:22 AM

bertrandleroy,

Thank you a lot..please do this helpful..

Thanks

selva

Developer
Sep 13, 2011 at 11:01 AM

Also see this similar discussion :

http://orchard.codeplex.com/discussions/270479