Video Gallery

Support

Error compiling template "Designs/Forney/ItemPublisher/List/Gallery.cshtml"
Line 200: 'Dynamicweb.Content.Page' does not contain a definition for 'Values' and no extension method 'Values' accepting a first argument of type 'Dynamicweb.Content.Page' could be found (are you missing a using directive or an assembly reference?)

1 @inherits RazorTemplateBase<RazorTemplateModel<Template>> 2 @using Dynamicweb.Rendering; 3 @{ string designName = GetString("Template:DesignBaseUrl").Replace("/Files/Templates/Designs/", "").Replace("/", ""); }@functions{ 4 public static string GetImage(string sourceString, int imageWidth, int imageHeight, int imageWidthTablet = 0, int imageHeightTablet = 0, int imageWidthMobile = 0, int imageHeightMobile = 0, string imageFormat = "jpg", int imageCompression = 0, int imageCrop = 5, string background = "", string designName = "Forney") 5 { 6 Dynamicweb.Frontend.PageView currentPageview = Dynamicweb.Frontend.PageView.Current(); 7 string currDevice = currentPageview.Device.ToString(), 8 alternativeImage = currentPageview.Area.Item["NoImage"] != null ? currentPageview.Area.Item["NoImage"].ToString() : "/Files/Templates/Designs/"+ designName + "/images/alternativeImage.jpg", 9 widthString = "", 10 heightString = "", 11 getImageFormat = imageFormat != "jpg" ? "&amp;Format=" + imageFormat : "", 12 getImageCompression = imageCompression != 0 ? "&amp;Compression=" + imageCompression : "", 13 bgColor = !string.IsNullOrEmpty(background) ? "&amp;backgroud="+background : ""; 14 int getImageWidth = imageWidth != 0 ? imageWidth : 0, 15 getImageHeight = imageHeight != 0 ? imageHeight : 0; 16 17 if (currDevice == Dynamicweb.Frontend.Devices.DeviceType.Tablet.ToString()) 18 { 19 getImageWidth = imageWidthTablet != 0 ? imageWidthTablet : getImageWidth; 20 getImageHeight = imageHeightTablet != 0 ? imageHeightTablet : getImageHeight; 21 } 22 else if (currDevice == Dynamicweb.Frontend.Devices.DeviceType.Mobile.ToString()) 23 { 24 getImageWidth = imageWidthMobile != 0 ? imageWidthMobile : getImageWidth; 25 getImageHeight = imageHeightMobile != 0 ? imageHeightMobile : getImageHeight; 26 } 27 28 if (getImageWidth != 0) 29 { 30 widthString = "&amp;Width=" + getImageWidth; 31 } 32 if (getImageHeight != 0) 33 { 34 heightString = "&amp;Height=" + getImageHeight; 35 } 36 37 string output = "/Admin/Public/GetImage.ashx?Image=" + sourceString + widthString + heightString + "&amp;altFmImage_path=" + alternativeImage + getImageFormat + getImageCompression + "&amp;Crop=" + imageCrop + bgColor; 38 return output; 39 } 40 public string GetYouTubeCode(string videoUrl) 41 { 42 43 int mInd1 = videoUrl.IndexOf("/v/"); //Suppose your youtube video url is looking like this: http://www.youtube.com/v/qPULu1Js3oA?version=3&feature=player_detailpage 44 int mInd2 = videoUrl.IndexOf("?v="); //Suppose your youtube video url is looking like this: https://www.youtube.com/watch?v=IQe3UABPKto 45 int mInd3 = videoUrl.IndexOf(".be/"); //Suppose your youtube video url is looking like this: https://youtu.be/jlUBcKcHgRw 46 string videoCode = ""; 47 int ind = 11; // Correction to alway look for 11 characters VIDEO _ID 48 49 if (mInd1 != -1) 50 { 51 videoCode = videoUrl.Substring(mInd1 + 3); 52 videoCode = videoCode.Substring(0, ind == -1 ? videoCode.Length : ind); 53 } 54 55 if (mInd2 != -1) 56 { 57 videoCode = videoUrl.Substring(mInd2 + 3); 58 videoCode = videoCode.Substring(0, ind == -1 ? videoCode.Length : ind); 59 } 60 61 if (mInd3 != -1) 62 { 63 videoCode = videoUrl.Substring(mInd3 + 4); 64 videoCode = videoCode.Substring(0, ind == -1 ? videoCode.Length : ind); 65 } 66 67 return videoCode; 68 69 } 70 71 72 public string GetYouTubeImage(string videoUrl, string version) 73 { 74 //Video Default jpg : default 75 //Video Medium Quality jpg : mqdefault 76 //Video High Quality jpg : hqdefault 77 //Other Screen Thumbnail jpg : 78 // 1 79 // 2 80 // 3 81 string thumbnailVersion = "default"; 82 switch(version) 83 { 84 case "default": 85 // Use the text block below to separate html elements from code 86 thumbnailVersion = "default"; 87 break; // Always break each case 88 case "mqdefault": 89 thumbnailVersion = "mqdefault"; 90 break; 91 case "hqdefault": 92 thumbnailVersion = "hqdefault"; 93 break; 94 default: 95 thumbnailVersion = "default"; 96 break; 97 } 98 99 100 string strVideoCode = GetYouTubeCode(videoUrl); 101 102 if (!string.IsNullOrEmpty(strVideoCode)) 103 { 104 105 return "https://img.youtube.com/vi/" + strVideoCode + "/"+thumbnailVersion+".jpg"; 106 } 107 else 108 return ""; 109 } 110 111 } 112 @{ 113 List<LoopItem> itemsList = GetLoop("ItemPublisher:Items.List"); 114 } 115 116 <div class="h2 galleryTitle">@Pageview.Page.Values["pagemenutext"].ToString()</div> 117 118 @if(itemsList.Any()) { 119 <ul class="gallery row" data-title='@Translate("galleries", "Galleries")'> 120 @foreach (LoopItem item in itemsList) 121 { 122 string link = !string.IsNullOrEmpty(item.GetString("ItemPublisher:Item.Video.Value")) ? item.GetString("ItemPublisher:Item.Video.Value") : "", 123 youtubeThumbnail = !string.IsNullOrEmpty(link)? GetYouTubeImage(link,"hqdefault") : "", 124 videoImage = !string.IsNullOrEmpty(item.GetString("ItemPublisher:Item.Image.Value")) ? item.GetString("ItemPublisher:Item.Image.Value") : "", 125 productGetImage = !string.IsNullOrEmpty(videoImage) ? GetImage(videoImage, 0, 400, 0, 250, 0, 200) : youtubeThumbnail, 126 title = item.GetString("ItemPublisher:Item.Title.Value"); 127 128 <li class="col-xs-12 col-sm-6 col-md-4"> 129 <figure> 130 <a class="fancybox" href="@link"> 131 @if(!string.IsNullOrEmpty(item.GetString("ItemPublisher:Item.Video.Value"))){ 132 <i class="fa fa-play-circle-o"></i> 133 } 134 <img class="img-responsive" src="@productGetImage" title="@title" alt="@title" /> 135 </a> 136 </figure> 137 @if(!string.IsNullOrEmpty(item.GetString("ItemPublisher:Item.Title.Value"))){ 138 <div> 139 @item.GetString("ItemPublisher:Item.Title.Value") 140 </div> 141 } 142 </li> 143 } 144 </ul> 145 } 146 147 @inherits RazorTemplateBase<RazorTemplateModel<Template>> 148 @using Dynamicweb.Rendering; 149 @{ 150 int totalPagesNum = GetInteger("ItemPublisher:Items.Paging.TotalPages"), 151 curPageNum = GetInteger("ItemPublisher:Items.Paging.CurrentPage"), 152 thisPage = 0, 153 prevPage = 0, 154 nextPage = 0; 155 string pagingHref = "", 156 pageText ="", 157 active = ""; 158 } 159 160 @if (totalPagesNum > 1) 161 { 162 <div class="col-xs-12 text-center paginationContainer"> 163 <span>@Translate("showing", "Showing") @GetString("ItemPublisher:Items.Count") @Translate("of", "of") @GetString("ItemPublisher:Items.TotalCount") @Translate("items", "items")</span> 164 <ul class="pagination"> 165 @if (GetString("ItemPublisher:Items.Paging.PrevPage") != "#") 166 { 167 prevPage = curPageNum - 1; 168 pagingHref = GetGlobalValue("Global:Request.Url").Contains("page") ? GetGlobalValue("Global:Request.Url").Replace("page=" + curPageNum, "page=" + prevPage) : GetGlobalValue("Global:Request.Url") + "&page=" + prevPage; 169 pageText = "&laquo; " + Translate("previous", "Previous") + " "; 170 @PageItem("",pagingHref, pageText) 171 } 172 @if(curPageNum > 2 && totalPagesNum > 3){ 173 for(int i=1;i <= 1;i++){ 174 active = curPageNum == i ? "class=\"active\"" : ""; 175 pagingHref = GetGlobalValue("Global:Request.Url").Contains("page") ? GetGlobalValue("Global:Request.Url").Replace("page="+curPageNum, "page=" + i ) : GetGlobalValue("Global:Request.Url") + "&page=" + i; 176 @PageItem(active,pagingHref, i.ToString()) 177 } 178 @Ellipsis() 179 } 180 @foreach (LoopItem page in GetLoop("ItemPublisher:Items.Paging.Pages3")) 181 { 182 thisPage = page.GetInteger("ItemPublisher:Items.Paging.Pages3.Page.Number"); 183 pagingHref = GetGlobalValue("Global:Request.Url").Contains("page") ? GetGlobalValue("Global:Request.Url").Replace("page="+curPageNum, "page=" + thisPage) : GetGlobalValue("Global:Request.Url") + "&page=" + thisPage; 184 active = page.GetBoolean("ItemPublisher:Items.Paging.Pages3.Page.IsCurrent") ? "class=\"active\"" : ""; 185 186 @PageItem(active, pagingHref, thisPage.ToString()) 187 } 188 @if(curPageNum < totalPagesNum-1 && totalPagesNum > 3){ 189 @Ellipsis() 190 for(int i=totalPagesNum;i <= totalPagesNum;i++){ 191 active = curPageNum == i ? "class=\"active\"" : ""; 192 pagingHref = GetGlobalValue("Global:Request.Url").Contains("page") ? GetGlobalValue("Global:Request.Url").Replace("page="+curPageNum, "page="+i) : GetGlobalValue("Global:Request.Url") + "&page=" + i; 193 194 @PageItem(active,pagingHref, i.ToString()) 195 } 196 } 197 @if (GetString("ItemPublisher:Items.Paging.NextPage") != "#") 198 { 199 nextPage = curPageNum + 1; 200 pagingHref = GetGlobalValue("Global:Request.Url").Contains("page") ? GetGlobalValue("Global:Request.Url").Replace("page="+curPageNum, "page="+ nextPage) : GetGlobalValue("Global:Request.Url") + "&page=" + nextPage; 201 pageText = " " + Translate("next", "Next") + " &raquo;"; 202 203 @PageItem("", pagingHref, pageText) 204 } 205 </ul> 206 </div> 207 } 208 209 @helper PageItem (string cssClass, string href, string text) { 210 <li @cssClass> 211 <a href="@href">@text</a> 212 </li> 213 } 214 @helper Ellipsis () { 215 <li><span>...</span></li> 216 } 217 218 @SnippetStart("jsOnLoad") 219 onLoadMedia(); 220 @SnippetEnd("jsOnLoad")
2057 Vermont Drive,
Fort Collins, CO 80525 Email: customerservice@forneyind.com Phone: 1-800-521-6038