Advertisement
Guest User

HTML CODE

a guest
Mar 6th, 2015
354
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.58 KB | None | 0 0
  1. @Umbraco.RenderMacro("PaginationExample")@inherits UmbracoTemplatePage
  2. @{
  3.     Layout = "umbLayout.cshtml";
  4.  
  5.     // If the editor has not explicitly provided the "Page title" property page
  6.     // then just show the name of the page otherwise show the provided title
  7.     var pageTitle = string.IsNullOrWhiteSpace(CurrentPage.Title)
  8.         ? CurrentPage.Name
  9.         : CurrentPage.Title;
  10.  
  11.     // Model.Content is the current page that we're on
  12.     // AncestorsOrSelf is all of the ancestors this page has in the tree
  13.     // (1) means: go up to level 1 and stop looking for more ancestors when you get there
  14.     // First() gets the first ancestor found (the home page, on level 1)
  15.     var homePage = CurrentPage.AncestorsOrSelf(1).First();    
  16.    
  17.     // Find all pages with document type alias umbNewsOverview
  18.     // We do that using the plural, umbNewsOverviews (note the extra "s" in the end)
  19.     // Then take the first one, as we know there will only be on news overview page
  20.     var newsOverview = homePage.umbNewsOverviews.First();
  21.  
  22.     // Similar to above: find all pages with document type umbNewsItem under the news overview page
  23.     // Then order them, first by publishDate (a property the editor can explicitly set on the news item)
  24.     // and then by createDate, which is set by Umbraco automatically when a page gets created.
  25.     var newsItems = newsOverview.umbNewsItems.OrderBy("publishDate desc, createDate desc").Take(5);
  26.  
  27. }
  28. <script>
  29.     window.onload=toBottom;
  30.    function toBottom() {
  31.        window.scrollTo(0, 800);
  32.    }
  33. </script>
  34. <!-- Main -->
  35. <br><br>
  36. <!-- /Main -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement