Problem on rendering details of list items

Topics: Writing themes
Jan 12, 2012 at 5:33 PM

Hi to all,

I am Alberto and i've just start tu use orchard. I am using it for building up a website but at this point i am facing a problem.
I want to put in the footer (FooterQuadThird) of all the pages a list of Events & News with a customized rendering and this is what i did.

  1. I created a custom content type News with the necessary informations and a List that contains these News.
  2. In the dashboard, widgets page i added the list in the FooterQuadThird using the Default it can appear in all the pages.
  3. The for customizing the rendering i used the alternate Widget-FooterQuadThird.cshtml with this content
    <h3>Events and News</h3> 
    <ul class="list-bottom">
  4. Then i used the alternate Parts.ContainerWidget.cshtml with this content
    IEnumerable<object> items = Model.ContentItems;

    @foreach (var item in items)
  5. Then as last i used the alternate Content-News.cshtml for customizing the way for rendering the single news in the list.
    Something like this.
    ContentItem contentItem = Model.ContentItem;
    string date = ...;
    HtmlString body = ...;
    <li><strong>@date</strong> - @body @Html.ItemDisplayLink( "Read", contentItem)</li>

At this point the rendering of the list of news in the footer of all the page is i want.
The problem appears when i click on the links of this list...for opening the details of a single news.

What i see is still the rendering from Content-News.cshtml.
Tried to solve the problem in 2 ways...but without good result.

Way 1
The url of each single news is following this structure 'http://localhost:30320/companynews/ + news_title'.
Looking for an alternate in the page of the single news i found Content-url-companynews.cshtml thinking that this can eventually have priority compare to Content-News.cshtml. But the rendering is still wrong.

 Way 2
I tried to specify and alternate using the file in this way.

<Match ContentType="News" Path="/companynews/*">
    <Place Parts_RoutableTitle="Header:0"/>
    <Place Content="Alternate=Content-url-companynews"/>

in the tag for alternate i tried also Content__url__companynews, but the result is the same...always the rendering as in the list.

Is there anyway met the same problem or give a suggestion on the solution?
Thank you so much.




Jan 12, 2012 at 5:39 PM

Use Content.Summary-News.cshtml instead I think.

Jan 12, 2012 at 5:59 PM

Great randompete! I've just tried your suggestion! It is working fine!

Thank you so much for your support.