Error compiling template "Designs/NemMark.dk/_parsed/subpage-form.parsed.cshtml"
Line 38: 'Dynamicweb.Frontend.PageView' does not contain a definition for 'DeviceType'
Line 43: 'Dynamicweb.Frontend.PageView' does not contain a definition for 'DeviceType'
Line 91: The variable 'countryCodeModule' is assigned but its value is never used
Line 107: The variable 'aboutUsUrl' is assigned but its value is never used
Line 108: The variable 'helpUrl' is assigned but its value is never used

1 @inherits RazorTemplateBase<RazorTemplateModel<Template>> 2 3 @using System.Text.RegularExpressions; 4 @using System.Web.UI.HtmlControls 5 @using Dynamicweb.Rendering; 6 7 @{ 8 9 string designFolder = GetString("Template:DesignBaseUrl"), 10 robots = "", 11 countryCodeModule = "DK", 12 userCountryCode = !string.IsNullOrEmpty(Pageview.User.Country) ? Pageview.User.Country.ToString() : "DK", 13 designName = designFolder.Replace("/Files/Templates/Designs/", "").Replace("/", ""), 14 templateFolder = "subpage-form", 15 device = Pageview.Device.ToString(), 16 longLang = Pageview.GlobalTags.GetTagByName("Global:Area.LongLang").Value.ToString(), 17 companyName = GetString("Item.CompanyName"), 18 title = (!string.IsNullOrEmpty(GetString("Item.Title"))) ? GetString("Item.Title") : companyName, 19 subtitle = GetString("Item.SubTitle"), 20 logoUrl = GetString("Item.LogoUrl"), 21 logoUrlTarget = (logoUrl.Contains("http://")) ? "_blank":"_self", 22 bannerUrl = GetString("Item.BannerUrl"), 23 phoneNumber = GetString("Item.Phone"), 24 description = GetString("Item.Description"), 25 banner = (!string.IsNullOrEmpty(GetString("Item.Image"))) ? GetString("Item.Image") : string.Format("{0}{1}/images/banner.png",designFolder,templateFolder), 26 bannerGetImage = GetImage(banner, 1200, 243, 1200, 243, 1200, 273, "jpg", 90, 0, "", "lmo"), 27 aboutUsUrl = "", 28 helpUrl = "", 29 bodyClass = string.Format("lmo-subapage-form {0}", device), 30 addresses = GetString("Item.Address").Replace("\n","<br>"); 31 32 }<!DOCTYPE HTML> 33 <!--[if lt IE 8 ]><html class="ie7" lang="@(longLang)"><![endif]--><!--[if IE 8 ]><html class="ie8" lang="@(longLang)"><![endif]--><!--[if IE 9 ]><html class="ie9" lang="@(longLang)"><![endif]--><!--[if (gt IE 9)|!(IE)]><!--> 34 <html lang="@(longLang)"><!--<![endif]--> 35 <head> 36 <!-- Google Tag Manager --> 37 <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': 38 new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], 39 j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 40 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); 41 })(window,document,'script','dataLayer','GTM-K9XXF29');</script> 42 <!-- End Google Tag Manager --> 43 <title>@GetValue("Title")</title> 44 <meta http-equiv="content-type" content="text/html; charset=utf-8"> 45 <meta name="viewport" content="initial-scale=1.0, width=device-width, user-scalable=no"> 46 <meta http-equiv="X-UA-Compatible" content="IE=edge"> 47 <meta name="SKYPE_TOOLBAR" content="SKYPE_TOOLBAR_PARSER_COMPATIBLE"> 48 @if (!string.IsNullOrEmpty(robots)) 49 { 50 <meta name="robots" content="@robots"> 51 } 52 53 @SnippetStart("OGMeta") 54 <meta property="og:title" content='@GetString("Title")'> 55 <meta property="og:image" content='@Pageview.GlobalTags.GetTagByName("Global:Request.Scheme").Value.ToString()://@Pageview.GlobalTags.GetTagByName("Global:Request.Host").Value.ToString()/Files/Templates/Designs/@designName/@(templateFolder)/images/logo.png'> 56 <meta property="og:site_name" content='@companyName'> 57 <meta property="og:url" content='@Pageview.GlobalTags.GetTagByName("Global:Request.Scheme").Value.ToString()://@Pageview.GlobalTags.GetTagByName("Global:Request.Host").Value.ToString()@Pageview.GlobalTags.GetTagByName("Global:Pageview.Url").Value.ToString()'> 58 <meta property="og:description" content='@StripHtml(GetString("Meta.Description"))'> 59 <meta property="og:type" content="article"> 60 <meta property="og:locale" content='@Pageview.GlobalTags.GetTagByName("Global:Area.LongLang").Value.ToString().Replace("-", "_")'> 61 @SnippetEnd("OGMeta") 62 63 @RenderSnippet("OGMeta") 64 @GetString("MetaTags") 65 @GetString("CopyRightNotice") 66 @GetString("Stylesheets") 67 @RenderSnippet("outScripts") 68 @GetString("Javascripts") 69 70 <link rel="shortcut icon" href="@(designFolder)@templateFolder/images/favicon.ico" type="image/x-icon"> 71 <link rel="stylesheet" type="text/css" href="@(designFolder)@templateFolder/css/exceptions/main.css"> 72 @* 73 <link rel="stylesheet" type="text/css" href="/public/aTools.ashx?a=min&amp;f=@(designFolder)@templateFolder/css&amp;ex=_bak,exceptions,ie.css&amp;m=0&amp;c=0"> 74 <link rel="stylesheet" type="text/css" href="@(designFolder)@templateFolder/css/exceptions/main.css"> 75 *@ 76 <script src="https://npmcdn.com/tether@1.2.4/dist/js/tether.min.js"></script> 77 <script src="@(designFolder)@templateFolder/js/exceptions/main.js"></script> 78 @* 79 <script src="/public/aTools.ashx?a=min&amp;f=@(designFolder)@templateFolder/js/&amp;ex=_bak,exceptions&amp;out=j&amp;m=0&amp;c=0"></script> 80 <script src="@(designFolder)@templateFolder/js/exceptions/main.js"></script> 81 *@ 82 @SnippetStart("outScripts") @SnippetEnd("outScripts") 83 @SnippetStart("bodyClass") @SnippetEnd("bodyClass") 84 @SnippetStart("jsOnLoad") @SnippetEnd("jsOnLoad") 85 86 <script type="text/javascript"> 87 $(function () { 88 @RenderSnippet("jsOnLoad") 89 }); 90 </script> 91 <!--[if lte IE 9]> 92 <script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script> 93 <script src="//cdnjs.cloudflare.com/ajax/libs/respond.js/1.1.0/respond.min.js"></script> 94 <script src="@(designFolder)@templateFolder/js/libraries/exceptions/01_ie.js"></script> 95 <link href="@(designFolder)@templateFolder/less/ie.css" rel="stylesheet" type="text/css" media="screen" /> 96 <![endif]--> 97 </head> 98 <body class='@bodyClass @RenderSnippet("bodyClass")'> 99 100 <!-- Google Tag Manager (noscript) --> 101 <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-K9XXF29" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> 102 <!-- End Google Tag Manager (noscript) --> 103 104 <div class="wrap container-fluid noPadding"> 105 <header id="headerContainer" class="container noPadding"> 106 <div id="topHeaderContainer" class="col-xs-12 noPadding"> 107 <figure class="col-xs-5 col-md-4"> 108 <a href="@logoUrl" target="@logoUrlTarget"> 109 <img class="img-responsive" src="@(designFolder)@templateFolder/images/logo.svg" alt="@companyName" title="@companyName"> 110 </a> 111 </figure> 112 <nav id="topMenuContainer" class="col-xs-7 col-md-8"> 113 @GetValue("DwNavigation(topMenu)") 114 </nav> 115 </div> 116 <div id="bannerContainer" class="col-xs-12 noPadding"> 117 <a href="@bannerUrl"> 118 <div> 119 <h1>@title</h1> 120 <span>@subtitle</span> 121 </div> 122 </a> 123 <img src="@bannerGetImage" class="img-responsive" alt="banner" title="banner"> 124 </div> 125 </header> 126 <section id="contentWrapper" class="container"> 127 <div class="col-xs-12 col-lg-8 col-lg-offset-2"> 128 @if (!string.IsNullOrEmpty(GetString("DwContent(homeContent)"))) 129 { 130 <section class="col-xs-12"> 131 <div id="homeContent" class="row">@GetValue("DwContent(homeContent)")</div> 132 </section> 133 } 134 </div> 135 </section> 136 <footer id="footer" class="container"> 137 <div class="col-xs-12 col-lg-8 col-lg-offset-2"> 138 <div class="col-xs-12 col-sm-6 noPaddingLeft"> 139 <h2>@Translate("Description", "Tjen mere med LMO")</h2> 140 <p>@description</p> 141 </div> 142 <div class="col-xs-12 col-sm-6 footer-contacts"> 143 <h2>@Translate("Contact", "Kontakt LMO")</h2> 144 <p> 145 @if (!string.IsNullOrEmpty(phoneNumber)) 146 { 147 @:<span class="phone-label">@Translate("Phone", "Telefon")</span> @phoneNumber<br> 148 } 149 @addresses 150 </p> 151 </div> 152 </div> 153 </footer> 154 </div> 155 </body> 156 </html> 157 158 @functions{ 159 160 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 = "lmo") 161 { 162 Dynamicweb.Frontend.PageView currentPageview = Dynamicweb.Frontend.PageView.Current(); 163 string currDevice = currentPageview.Device.ToString(), 164 alternativeImage = "/Files/Templates/Designs/" + designName + "/subpage-form/images/alternativeImage.jpg", 165 widthString = "", 166 heightString = "", 167 getImageFormat = imageFormat != "jpg" ? "&amp;Format=" + imageFormat : "", 168 getImageCompression = imageCompression != 0 ? "&amp;Compression=" + imageCompression : "", 169 bgColor = !string.IsNullOrEmpty(background) ? "&amp;backgroud=" + background : ""; 170 int getImageWidth = imageWidth != 0 ? imageWidth : 0, 171 getImageHeight = imageHeight != 0 ? imageHeight : 0; 172 173 if (currDevice == Dynamicweb.Frontend.PageView.DeviceType.Tablet.ToString()) 174 { 175 getImageWidth = imageWidthTablet != 0 ? imageWidthTablet : getImageWidth; 176 getImageHeight = imageHeightTablet != 0 ? imageHeightTablet : getImageHeight; 177 } 178 else if (currDevice == Dynamicweb.Frontend.PageView.DeviceType.Mobile.ToString()) 179 { 180 getImageWidth = imageWidthMobile != 0 ? imageWidthMobile : getImageWidth; 181 getImageHeight = imageHeightMobile != 0 ? imageHeightMobile : getImageHeight; 182 } 183 184 if (getImageWidth != 0) 185 { 186 widthString = "&amp;Width=" + getImageWidth; 187 } 188 if (getImageHeight != 0) 189 { 190 heightString = "&amp;Height=" + getImageHeight; 191 } 192 193 string output = "/Admin/Public/GetImage.ashx?Image=" + sourceString + widthString + heightString + "&amp;altFmImage_path=" + alternativeImage + getImageFormat + getImageCompression + "&amp;Crop=" + imageCrop + bgColor; 194 return output; 195 } 196 197 private string CommaSplittedString(string CommaSplittedString, string NewString) 198 { 199 200 if (!string.IsNullOrEmpty(CommaSplittedString)) 201 { 202 CommaSplittedString += ", "; 203 } 204 CommaSplittedString = NewString; 205 206 return CommaSplittedString; 207 } 208 209 public static string StripHtml(string source) 210 { 211 return Regex.Replace(source, "<.*?>", string.Empty); 212 } 213 214 } 215