Photo Album with Author (Detail Page)
A Detail page is a template to be used for a particular type of content. This code creates a Photo Album Detail page that will be used to display each Photo Album. It'll display the photos in the album, and then the Author(s)' information. The Photo Albums view doesn't exist, so you'll have to create it. The instructions are included in the beginning of the code as comments. In order to work with the Photo Albums Lister Page code block, the Friendly URL of this page should be "album".
<!--A Detail page is a template to be used for a particular type of content. --> <!--This code creates a Photo Album Detail page that will be used to display each Photo Album. --> <!--It'll display the photos in the album, and then the Author(s)' information. --> <!--The Photo Albums view doesn't exist, so you'll have to create it. --> <!--The instructions are included in the beginning of the code as comments. --> <!--In order to work with the Photo Albums Lister Page code block, the Friendly URL of this page should be "album".--> <!--This code block creates a detail Photo Album page including author(s) info (if present).--> <!--** To use this page you must have an existing "Photo Albums" View.**--> <!--To create the View:--> <!--In the dashboard main menu, click Admin > Views. You'll see a list of your existing views. --> <!--If you don't see the "PhotoAlbums" view, don't worry - we can create it easily.--> <!--Click the green "+New" button on the right side and select "I'd like to create a new type of Content". --> <!--Enter the name "Photo Albums" (without the quote marks) and click Create.--> <!--Save the view and you're done.--> <!--* All "Detail" pages should be marked "Hide from menus" and "Hide in sitemap" in the page's Properties tab.--> @section head { <link href="/files/content/www/lightbox/lightbox.css" rel="stylesheet"/> <link href="/files/content/www/lightbox/photoalbums.css" rel="stylesheet"/> } <div id="photogalleries"> @BRT.Detail(tableId: "Content", viewId: "PhotoAlbums", fields: new[] {"Title","Files","Authors","Body", "Authors.PrimaryImage","Authors.Type","Authors.PreferredName","Authors.FirstName","Authors.MiddleName","Authors.LastName", "Authors.NameSuffix","Authors.DoNotEmail","Authors.Email","Authors.Description","Authors.Links.Type","Authors.Links.Link"}, template: @<div class="album"> <small> <div class="media-metadata text-muted"> @if(!item.IsDBNull("Authors") && item.GetRecordList("Authors").Count > 0) { <span>by: </span> <span class="topics"> @foreach(EngineRecord item_authors in item.GetRecordList("Authors")) { <span> <a href="/author/@item_authors.Href"> @if(!item_authors.IsDBNull("PreferredName")) { <span>@item_authors["PreferredName"]</span> } else { <span>@item_authors["FirstName"]</span> } @if(!item_authors.IsDBNull("MiddleName")) { <span>@item_authors["MiddleName"]</span> } @if(!item_authors.IsDBNull("LastName")) { <span>@item_authors["LastName"]</span> } @if(!item_authors.IsDBNull("NameSuffix")) { <span>@item_authors["NameSuffix"]</span> } </a> </span> } </span> } </div> </small> @if(!item.IsDBNull("Body")){ <div>@BRT.Raw(@item.GetString("Body"))</div> } <div class="row"> @if (item.GetFiles("Files").Count>0) { for(int photo = 0; photo < @item.GetFiles("Files").Count; photo++) { <div class="col-lg-3 col-md-4 col-sm-6 col-xs-12"> <div class="albumbox"> <a href="@item.GetFiles("Files")[photo].Url" data-title="@item.GetFiles("Files")[photo].Description" data-lightbox="gallery"><img class="img-fluid" src="@item.GetFiles("Files")[photo].Url?width=468&height=468&mode=crop&enlarge=true" /></a> @if(!String.IsNullOrEmpty(item.GetFiles("Files")[photo].Title) || !String.IsNullOrEmpty(item.GetFiles("Files")[photo].Description)){ <a href="@item.GetFiles("Files")[photo].Url" data-title="@item.GetFiles("Files")[photo].Description" data-lightbox="gallery"> <div class="albumdeets"> <h5 class="albumtitle">@item.GetFiles("Files")[photo].Title</h5> </div> </a> } </div> </div> } } </div> @if(!item.IsDBNull("Authors") && item.GetRecordList("Authors").Count > 0) { string authorCount = "Authors"; if(item.GetRecordList("Authors").Count == 1) { authorCount = "Author"; } <div class="box box-bg"> <h4>@authorCount</h4> @foreach(EngineRecord item_authors in item.GetRecordList("Authors")) { <div class="media"> @if(!item_authors.IsDBNull("PrimaryImage") && item_authors.GetFiles("PrimaryImage").Count > 0) { if(item_authors.GetFiles("PrimaryImage")[0].ContentType.StartsWith("image/")) { <a href="/author/@item_authors.Href"> <img src="@(item_authors.GetFiles("PrimaryImage")[0].Url)?width=120&height=120&mode=crop" class="img-fluid primaryImg mr-3" alt="@(String.IsNullOrEmpty(item_authors.GetFiles("PrimaryImage")[0].Title) ? item_authors.GetFiles("PrimaryImage")[0].Filename : item_authors.GetFiles("PrimaryImage")[0].Title)"/> </a> } } <div class="media-body"> <h5> <a href="/author/@item_authors.Href"> @if(!item_authors.IsDBNull("PreferredName")) { <span>@item_authors["PreferredName"]</span> } else { <span>@item_authors["FirstName"]</span> } @if(!item_authors.IsDBNull("MiddleName")) { <span>@item_authors["MiddleName"]</span> } @if(!item_authors.IsDBNull("LastName")) { <span>@item_authors["LastName"]</span> } @if(!item_authors.IsDBNull("NameSuffix")) { <span>@item_authors["NameSuffix"]</span> } </a> </h5> @if(!item_authors.IsDBNull("Description")) { <p>@item_authors.GetString("Description").Summarize(250)</p> } <div class="social"> @if(!item_authors.IsDBNull("Email")) { <span><a href="mailto:@item_authors["Email"]" class="email" data-toggle="tooltip" title="Email" ></a></span> } @if(!item_authors.IsDBNull("Links") && item_authors.GetRecordList("Links").Count > 0) { foreach(EngineRecord item_authors_links in item_authors.GetRecordList("Links")) { if(!item_authors_links.IsDBNull("Type")) { if(!item_authors_links.IsDBNull("Link")) { <span><a href="@item_authors_links["Link"]" class="@item_authors_links.GetCategory("Type")[0].Label.ToLower()" target="_blank" data-toggle="tooltip" title="@item_authors_links.GetCategory("Type")[0].Label" ></a></span> } } else { if(!item_authors_links.IsDBNull("Link")) { <span><a href="@item_authors_links["Link"]" class="website" target="_blank" data-toggle="tooltip" title="Link" ></a></span> } } } } </div> </div> </div> } </div> } </div>) </div> <script src="/files/content/www/lightbox/lightbox.min.js"></script>