@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@using System;
@using System.Globalization;
@using Umbraco.Web.Media;
@{
// Model.Content is the current page that we're on
// AncestorsOrSelf is all of the ancestors this page has in the tree
// (1) means: go up to level 1 and stop looking for more ancestors when you get there
// First() gets the first ancestor found (the home page, on level 1)
var homePage = CurrentPage.AncestorsOrSelf(1).First();
// Find all pages with document type alias umbNewsOverview
// We do that using the plural, umbNewsOverviews (note the extra "s" in the end)
// Then take the first one, as we know there will only be on news overview page
var MeetingPaperOverview = homePage.umbMeetingPaperOverviews.First();
// Similar to above: find all pages with document type umbNewsItem under the news overview page
// Then order them, first by publishDate (a property the editor can explicitly set on the news item)
// and then by createDate, which is set by Umbraco automatically when a page gets created.
// Finally, take the first 5 items to show in the news overview
var MeetingPaperItems = MeetingPaperOverview.umbMeetingPaperItem.OrderBy("publishDate desc, createDate desc").Take(20);
}
<table class="table table-hover attachments">
<thead>
<tr>
<th class="attachment-summary-toggle"></th>
<th class="filename-column">File</th>
<th class="modified-column">Modified</th>
</tr>
</thead>
<tbody>
<!-- Meeting Papers -->
@foreach (var MeetingPaperItem in MeetingPaperItems)
{
// If the editor has not explicitly provided the "Page title" property page
// then just show the name of the page otherwise show the provided title
var title = string.IsNullOrWhiteSpace(MeetingPaperItem.Title)
? MeetingPaperItem.Name
: MeetingPaperItem.Title;
// If the editor has not explicitly set the publishDate property then show the create date
var dateTime = MeetingPaperItem.PublishDate == default(DateTime)
? MeetingPaperItem.CreateDate
: MeetingPaperItem.PublishDate;
<tr>
<td><span class="fa fa-chevron-right" title="Show more info"></span></td>
<td>
<span class="fa fa-file-pdf-o" style="font-size: 14px;" title="PDF File"> </span>
<a href="@MeetingPaperItem.fileName" class="" title="Download" data-filename=""> @MeetingPaperItem.siteTitle</a>
</td>
<td>Sep 15, 2014 by Christine Healy</td>
</tr>
}
<!-- /Meeting Papers -->
</tbody>
</table>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<h1>Model Content ID is : @Model.Content.Id</h1>
I have just tried to use your could agaist the Txt, and I think that you are very close, you just needs to make some small changes. I have made the change bold so you can see where the changes is.
Try this snippet of code.
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@using System;
@using System.Globalization;
@using Umbraco.Web.Media;
@{
// Model.Content is the current page that we're on
// AncestorsOrSelf is all of the ancestors this page has in the tree
// (1) means: go up to level 1 and stop looking for more ancestors when you get there
// First() gets the first ancestor found (the home page, on level 1)
var homePage = CurrentPage.AncestorsOrSelf(1).First();
// Find all pages with document type alias umbNewsOverview
// We do that using the plural, umbNewsOverviews (note the extra "s" in the end)
// Then take the first one, as we know there will only be on news overview page
var MeetingPaperOverview = homePage.umbMeetingPaperOverview.First();
// Similar to above: find all pages with document type umbNewsItem under the news overview page
// Then order them, first by publishDate (a property the editor can explicitly set on the news item)
// and then by createDate, which is set by Umbraco automatically when a page gets created.
// Finally, take the first 5 items to show in the news overview
var MeetingPaperItems = MeetingPaperOverview.umbMeetingPaperItems.OrderBy("publishDate desc, createDate desc").Take(20);
}
<table class="table table-hover attachments">
<thead>
<tr>
<th class="attachment-summary-toggle"></th>
<th class="filename-column">File</th>
<th class="modified-column">Modified</th>
</tr>
</thead>
<tbody>
<!-- Meeting Papers -->
@foreach (var MeetingPaperItem in MeetingPaperItems)
{
// If the editor has not explicitly provided the "Page title" property page
// then just show the name of the page otherwise show the provided title
var title = string.IsNullOrWhiteSpace(MeetingPaperItem.Title)
? MeetingPaperItem.Name
: MeetingPaperItem.Title;
// If the editor has not explicitly set the publishDate property then show the create date
var dateTime = MeetingPaperItem.PublishDate == default(DateTime)
? MeetingPaperItem.CreateDate
: MeetingPaperItem.PublishDate;
<tr>
<td><span class="fa fa-chevron-right" title="Show more info"></span></td>
hi Dennis Aaen. Thanks for answer but it doesn't work. Sorry
The items (001, 002, 003 etc ...) in the bottom of the Meeting Papers under the Home Content I want to list different Template (content.cshtml) as partial view.
When adding different templates partial views
Hello!
I'm making a logical error can you help.
I thought you understood from the following screen image.
Partial Views
Partials/MeetingPapers.cshtml file :
Templates
Content.cshtml
but when it comes to the content template page render empty as follows
Hi ibrahim TUNC,
I have just tried to use your could agaist the Txt, and I think that you are very close, you just needs to make some small changes. I have made the change bold so you can see where the changes is.
Try this snippet of code.
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@using System;
@using System.Globalization;
@using Umbraco.Web.Media;
@{
// Model.Content is the current page that we're on
// AncestorsOrSelf is all of the ancestors this page has in the tree
// (1) means: go up to level 1 and stop looking for more ancestors when you get there
// First() gets the first ancestor found (the home page, on level 1)
var homePage = CurrentPage.AncestorsOrSelf(1).First();
// Find all pages with document type alias umbNewsOverview
// We do that using the plural, umbNewsOverviews (note the extra "s" in the end)
// Then take the first one, as we know there will only be on news overview page
var MeetingPaperOverview = homePage.umbMeetingPaperOverview.First();
// Similar to above: find all pages with document type umbNewsItem under the news overview page
// Then order them, first by publishDate (a property the editor can explicitly set on the news item)
// and then by createDate, which is set by Umbraco automatically when a page gets created.
// Finally, take the first 5 items to show in the news overview
var MeetingPaperItems = MeetingPaperOverview.umbMeetingPaperItems.OrderBy("publishDate desc, createDate desc").Take(20);
}
<table class="table table-hover attachments">
<thead>
<tr>
<th class="attachment-summary-toggle"></th>
<th class="filename-column">File</th>
<th class="modified-column">Modified</th>
</tr>
</thead>
<tbody>
<!-- Meeting Papers -->
@foreach (var MeetingPaperItem in MeetingPaperItems)
{
// If the editor has not explicitly provided the "Page title" property page
// then just show the name of the page otherwise show the provided title
var title = string.IsNullOrWhiteSpace(MeetingPaperItem.Title)
? MeetingPaperItem.Name
: MeetingPaperItem.Title;
// If the editor has not explicitly set the publishDate property then show the create date
var dateTime = MeetingPaperItem.PublishDate == default(DateTime)
? MeetingPaperItem.CreateDate
: MeetingPaperItem.PublishDate;
<tr>
<td><span class="fa fa-chevron-right" title="Show more info"></span></td>
<td>
<span class="fa fa-file-pdf-o" style="font-size: 14px;" title="PDF File"> </span>
<a href="@MeetingPaperItem.fileName" class="" title="Download" data-filename=""> @MeetingPaperItem.siteTitle</a>
</td>
<td>Sep 15, 2014 by Christine Healy</td>
</tr>
}
<!-- /Meeting Papers -->
</tbody>
</table>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<h1>Model Content ID is : @Model.Content.Id</h1>
And if there are problems then, then make sure that the alias of the document types are correct.
Hope this helps,
/Dennis
Hi again,
You can find the alias of the document type by going to the Settings section --> Document Types,
I have made a screen shot to make a easier to see where you can find the alias.
This alias must match your varaibles in the Razor file in this lines.
Hope this helps too,
/Dennis
hi Dennis Aaen. Thanks for answer but it doesn't work. Sorry
The items (001, 002, 003 etc ...) in the bottom of the Meeting Papers under the Home Content I want to list different Template (content.cshtml) as partial view.
is working on a reply...