Latest from our blog

Error compiling template "Designs/Rapido/ItemPublisher/List/BlogList.cshtml"
Line 0: Metadata file 'c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\f578936c\8354dd1e\assembly\dl3\63bcbcd1\006be3d9_cfc4d201\Dynamicweb.TemplateCompatibilityPack.DLL' could not be opened -- 'Not enough storage is available to complete this operation. '

1 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2 @using System.Web; 3 4 @functions { 5 public string Truncate(string value, int maxChars) 6 { 7 return value.Length <= maxChars ? value : value.Substring(0, maxChars) + "..."; 8 } 9 } 10 11 @{ 12 string selectedCategory = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("Category")) ? HttpContext.Current.Request.QueryString.Get("Category") : Translate("All"); 13 var query = HttpUtility.ParseQueryString(HttpContext.Current.Request.QueryString.ToString()); 14 15 var categoryFields = GetLoop("ItemPublisher:ItemType.Fields").FirstOrDefault((item) => item.GetString("ItemPublisher:ItemType.Field.SystemName") == "Category"); 16 foreach (var options in categoryFields.GetLoop("ItemPublisher:ItemType.Field.Options")) 17 { 18 selectedCategory = selectedCategory == options.GetString("ItemPublisher:ItemType.Field.Option.Value") ? options.GetString("ItemPublisher:ItemType.Field.Option.Label") : selectedCategory; 19 } 20 } 21 22 <div class="grid__col-md-8 grid__col-sm-12 grid__col-xs-12"> 23 24 <div class="grid"> 25 <div class="grid__col-12"> 26 <div class="collection u-no-margin"> 27 <h5>@Translate("Category")</h5> 28 <input type="checkbox" id="CategorySelector" class="dropdown-trigger" /> 29 <div class="dropdown u-w180px dw-mod"> 30 <label class="dropdown__header dropdown__btn dw-mod" for="CategorySelector">@selectedCategory</label> 31 <div class="dropdown__content dw-mod"> 32 @{ 33 query.Set("Category", ""); 34 <div class="dropdown__item" onclick="window.location = '/Default.aspx?@query.ToString()'">@Translate("All")</div> 35 36 foreach (var options in categoryFields.GetLoop("ItemPublisher:ItemType.Field.Options")) 37 { 38 query.Set("Category", options.GetString("ItemPublisher:ItemType.Field.Option.Value")); 39 <div class="dropdown__item" onclick="window.location = '/Default.aspx?@query.ToString()'">@options.GetString("ItemPublisher:ItemType.Field.Option.Label")</div> 40 } 41 } 42 </div> 43 <label class="dropdown-trigger-off" for="CategorySelector"></label> 44 </div> 45 </div> 46 </div> 47 48 <div class="grid"> 49 @foreach (LoopItem blogItem in GetLoop("ItemPublisher:Items.List")) 50 { 51 string date = !string.IsNullOrWhiteSpace(blogItem.GetString("ItemPublisher:Item.Date")) ? blogItem.GetDate("ItemPublisher:Item.Date").ToString("dd.MM.yyyy, HH:mm") : ""; 52 string subscription = ""; 53 54 if (!(string.IsNullOrWhiteSpace(blogItem.GetString("ItemPublisher:Item.Author")) && string.IsNullOrWhiteSpace(@date))) 55 { 56 subscription += Translate("Written"); 57 } 58 if (!string.IsNullOrWhiteSpace(blogItem.GetString("ItemPublisher:Item.Author"))) 59 { 60 subscription += " " + Translate("by") + " " + blogItem.GetString("ItemPublisher:Item.Author"); 61 } 62 if (!string.IsNullOrWhiteSpace(@date)) 63 { 64 subscription += " " + Translate("on") + " " + date; 65 } 66 67 <div class="grid__col-md-4 grid__col-sm-4 grid__col-xs-12 grid__col-xxs-12"> 68 <a href="/Default.aspx?ID=@blogItem.GetString("ItemPublisher:Item.Field.PageId")"> 69 <img src="/Admin/Public/GetImage.ashx?width=800&height=600&amp;crop=0&amp;DoNotUpscale=true&amp;Compression=75&amp;image=@blogItem.GetString("ItemPublisher:Item.Image")" alt="@blogItem.GetString("ItemPublisher:Item.Title")" /> 70 </a> 71 </div> 72 <div class="grid__col-md-8 grid__col-sm-8 grid__col-xs-12 grid__col-xxs-12"> 73 <a href="/Default.aspx?ID=@blogItem.GetString("ItemPublisher:Item.Field.PageId")"><h2 class="article__header u-truncate-text dw-mod">@blogItem.GetString("ItemPublisher:Item.Title")</h2></a> 74 <small class="article__subscription dw-mod">@subscription</small> 75 76 <p class="article__short-summary dw-mod">@Truncate(blogItem.GetString("ItemPublisher:Item.Summary"), 120)</p> 77 78 <div class="grid__cell-footer"> 79 <a href="/Default.aspx?ID=@blogItem.GetString("ItemPublisher:Item.Field.PageId")" class="btn btn--secondary u-no-margin dw-mod">@Translate("Read more")</a> 80 </div> 81 </div> 82 } 83 </div> 84 </div> 85 </div>