• Gespecialiseerd marketingteam
  • Vaste prijs
  • Kanaalonafhankelijk
  • Focus op resultaat
  • Flexibel & snel
    Error executing template "Designs/Jerome_generated/Paragraph/Carousel.cshtml"System.NullReferenceException: Object reference not set to an instance of an object.at CompiledRazorTemplates.Dynamic.RazorEngine_f63a1657b9cb4fe99ac580fe728a97c7.Execute() in D:\virtual_hosts\bluedeskCorporate\files\Templates\Designs\Jerome_generated\Paragraph\Carousel.cshtml:line 17at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)at RazorEngine.Templating.RazorEngineCore.RunTemplate(ICompiledTemplate template, TextWriter writer, Object model, DynamicViewBag viewBag)at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)at RazorEngine.Templating.DynamicWrapperService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.b__0(TextWriter writer)at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)at RazorEngine.Templating.RazorEngineServiceExtensions.RunCompile(IRazorEngineService service, String name, Type modelType, Object model, DynamicViewBag viewBag)at RazorEngine.Templating.RazorEngineServiceExtensions.RunCompile(IRazorEngineService service, ITemplateSource templateSource, String name, Type modelType, Object model, DynamicViewBag viewBag)at Dynamicweb.Rendering.Template.RenderRazorTemplate() in E:\Agent\_work\169\s\06 - Dynamicweb Host\Dynamicweb\Dynamicweb-9.9\Dynamicweb\Rendering\Template.cs:line 902
    1 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2 @using Dynamicweb; 3 @using Dynamicweb.Content.Items; 4 @using Bluedesk.DynamicWeb.ItemTypes; 5 @using Bluedesk.DynamicWeb.ItemTypes.Pages; 6 @using Bluedesk.Tools.DynamicWeb.ExtensionMethods; 7 @using Bluedesk.Tools.Generic.ExtensionMethods 8 @using System.Linq; 9 @using Dynamicweb.Content; 10 11 <!-- FIX NEEDED: behaviour when all the items are full height images (for instance logo slider)?? --> 12 13 @{ 14 Carousel _data = ItemManager.Storage.GetById<Carousel>(Pageview.CurrentParagraph.ItemId ?? "0"); 15 16 var paragraphID = Pageview.CurrentParagraph.ID; 17 int amountColumns = _data.CarouselItems.Count; // Amount of the columns in backend, filled by user 18 var classFullWidth = !_data.Fullwidth ? "container" : "w-full"; // If slider or multicolumn has to be in container or full width of the page 19 } 20 21 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 22 @using Dynamicweb; 23 @using Dynamicweb.Content.Items; 24 @using Bluedesk.DynamicWeb.ItemTypes; 25 26 27 @{ 28 string fullWidthContainerClass = _data.Fullwidth ? "" : "container"; 29 30 string backgroundClass = !string.IsNullOrWhiteSpace(_data.BackgroundConfiguration.BackgroundClass) ? string.Format("bg-{0}", _data.BackgroundConfiguration.BackgroundClass) : ""; 31 string backgroundStyle = !string.IsNullOrWhiteSpace(_data.BackgroundConfiguration.BackgroundColor) ? $"background-color: {_data.BackgroundConfiguration.BackgroundColor}; " : ""; 32 backgroundStyle += !string.IsNullOrWhiteSpace(_data.BackgroundConfiguration.BackgroundImage) ? $"background-image: url({_data.BackgroundConfiguration.BackgroundImage}); " : ""; 33 } 34 35 36 @functions { 37 string getbackgroundclass(string backgroundClass) 38 { 39 return !string.IsNullOrWhiteSpace(backgroundClass) ? string.Format("bg-{0}" ,backgroundClass) : ""; 40 } 41 } 42 43 @helper CTAParagraphImage(ParagraphImageResizable Image, bool ImageAsBackground, string ImagePosition, bool ParallaxImage, bool Fullwidth, string imagesHeight, double ColumnWidthSize) 44 { 45 if (!string.IsNullOrWhiteSpace(Image.Image)) 46 { 47 48 string image = !string.IsNullOrWhiteSpace(Image.Image) ? Image.Image : null; 49 imagesHeight = !string.IsNullOrWhiteSpace(imagesHeight) ? "height: " + imagesHeight + ";" : ""; 50 51 string imageParrallax = ParallaxImage ? "rellax" : ""; 52 string imageAsBackground = ImageAsBackground ? "cta-paragraph__image--is-background" : ""; 53 double imageWidth = 2000; 54 55 imageWidth = Fullwidth ? imageWidth : 1200; 56 imageWidth = imageWidth*ColumnWidthSize; 57 58 string strImageWidth = imageWidth + "px"; 59 string strImageWidthSize = imageWidth + "w"; 60 61 string ImageUrl = "/Admin/Public/GetImage.ashx?Image=" + image + "&Crop=0&Compression=80"; 62 63 if (!string.IsNullOrWhiteSpace(Image.Image)) 64 { 65 <figure class="cta-paragraph__image-container @imageAsBackground @Image.PositionY @Image.PositionX" style="@imagesHeight"> 66 67 <picture class="cta-paragraph__image @Image.BackgroundSize @imageParrallax"> 68 <source media="(max-width: 400px)" srcset="@ImageUrl&Width=400"> 69 <source media="(max-width: 994px)" srcset="@ImageUrl&Width=994"> 70 <img src="@ImageUrl&Width=@imageWidth" alt="@Image.ImageAlt" class="cta-paragraph__image @Image.BackgroundSize @imageParrallax"> 71 </picture> 72 73 </figure> 74 } 75 } 76 } 77 78 79 @helper CTAParagraphContent(ParagraphHeader Header, ParagraphHeader SubHeader, ParagraphContent Content, CTAButton Button, ParagraphImage Image, bool strCenterVertical) 80 { 81 82 bool hasImage = !string.IsNullOrWhiteSpace(Image.Image) ? true : false; 83 string noImageClass = hasImage ? "" : "no-image"; 84 85 string centerTextClass = strCenterVertical ? "text-center" : ""; 86 string centerContent = !string.IsNullOrWhiteSpace(Image.Image) ? "" : "cta-paragraph__content--center"; 87 88 string buttonIconClass = Pageview.Area.Item["Global_button_icon"] != null ? Pageview.Area.Item["Global_button_icon"].ToString().Replace("+", " ") : "fal fa-arrow-right"; 89 90 <style> 91 .cta-paragraph__container { 92 height: 100% !important; /* Temp Hack to solve iPhone bug.. */ 93 } 94 </style> 95 96 if (!string.IsNullOrWhiteSpace(Button.ButtonText) || !string.IsNullOrWhiteSpace(Content.Text) || !string.IsNullOrWhiteSpace(Header.HeaderFormatted("cta-paragraph__header"))) 97 { 98 <section class="cta-paragraph__content @centerContent @noImageClass"> 99100 <article class="cta-paragraph__content-container @centerTextClass @noImageClass">101102 @if (!string.IsNullOrWhiteSpace(Header.HeaderFormatted("cta-paragraph__header")))103 {104 <header class="cta-paragraph__header @centerTextClass">105 @if (SubHeader != null)106 {107 @SubHeader.HeaderFormatted("cta-paragraph__subheader")108 }109 @Header.HeaderFormatted("cta-paragraph__header")110 </header>111 }112113 @if (!string.IsNullOrWhiteSpace(Content.Text))114 {115 <div class="cta-paragraph__text @centerTextClass">@Content.Text</div>116 }117118 </article>119120 @if (!string.IsNullOrWhiteSpace(Button.ButtonLink) && !string.IsNullOrWhiteSpace(Button.ButtonText))121 {122 <a href="@Button.ButtonLink" class="btn cta-paragraph__btn @Button.Configuration.ButtonClass">123 <span class="btn__text cta-paragraph__btn-label">@Button.ButtonText</span>124 <i class="btn__icon cta-paragraph__btn-icon @buttonIconClass"></i>125 </a>126 }127128 </section>129130 }131132 }133134135 @if (amountColumns > 0)136 {137 <div class="multicolumn overflow-hidden @backgroundClass @_data.CssClass" data-paragraphid="@paragraphID" id="@paragraphID">138 <div class="@classFullWidth">@RenderContentArea(_data)</div>139 </div>140 }141142 @helper RenderContentArea(Carousel _data)143 {144 int amountColumns = _data.CarouselItems.Count; // Amount of the columns in backend, filled by user145 var buttonIconClass = Pageview.Area.Item["Global_button_icon"] != null ? Pageview.Area.Item["Global_button_icon"].ToString().Replace("+", " ") : "fal fa-arrow-right";146147 string centerTextClass = _data.CenterText ? "items-center text-center" : "items-start text-left";148149 /* Specific for Carousel */150151 int colDisplay = _data.ColumnsDisplay; // Amount of displayed column within one screen152153 bool fullWidth = _data.Fullwidth; // If slider or multicolumn has to be in container or full widthof the page154 bool infiniteLoop = _data.Infinite;155 bool autoPlay = _data.AutoPlay;156 bool controls = _data.AddControls;157 bool duration = _data.Duration;158 bool showDots = _data.ShowDots; // If slider or multicolumn has to be in container or full widthof the page159 int colAmount = 1;160161 bool imagesOnlyBool = checkOnlyImages(_data); // Check if this carousel contains only images (logo slider)162163 if (!string.IsNullOrWhiteSpace(@_data.Header.HeaderFormatted()))164 {165 <header class="multicolumn__header-wrapper">166 @_data.Header.HeaderFormatted("multicolumn__header")167 </header>168 }169170 string carouselHeight = "auto";171172 if (imagesOnlyBool && _data.ImageHeight != 0)173 {174 carouselHeight = _data.ImageHeight.ToString() + "px";175 }176177 if ((colDisplay <= amountColumns) && (colDisplay != 0))178 {179 string flexBasis = 100 / @colDisplay + "%";180181 <section class="carousel multicolumn"182 data-columns="@colAmount"183 data-dots="@showDots"184 data-loop="@infiniteLoop"185 data-autoplay="@autoPlay"186 data-controls="@controls"187 data-duration="@duration"188 style="height: @carouselHeight;">189190 @foreach (var column in _data.CarouselItems)191 {192193 bool hasContent = !string.IsNullOrWhiteSpace(column.Button.ButtonText) || !string.IsNullOrWhiteSpace(column.Content.Text) || !string.IsNullOrWhiteSpace(column.Header.HeaderFormatted());194195 string image = column.Image.Image;196 string imagesHeight = _data.ImageHeight == 0 ? "auto" : _data.ImageHeight.ToString() + "px";197 string ImageContainerFixed = hasContent ? "cta-paragraph__image-container--fixed" : "";198 string ImageAsBackground = (column.BackgroundConfiguration.ConfigurationName == "Image as Background") ? "cta-paragraph__image--is-background" : "";199200 string coverImage = "";201202 string figureHeight = !hasContent ? "flex-grow:1" : "height:" + imagesHeight;203 string TempClass = imagesOnlyBool ? "imageOnly" : "hasContent";204 string ImageOnlyImageHeight = imagesOnlyBool ? "height:" + imagesHeight + ";" : "height:auto;";205206 if (!imagesOnlyBool)207 {208 imagesHeight = hasContent ? imagesHeight : imagesHeight = "100%";209 }210211 /*This is work around created by Alla to enable cover mode for stand alone pictures*/212 if (!hasContent && column.Image.BackgroundSize == "bg-cover")213 {214 coverImage = "height:100%;";215 }216217 <div class="carousel-cell-wrap" style="display: flex; min-height:100%; @ImageOnlyImageHeight width: @flexBasis; @coverImage">218219 <section class="cta-paragraph carousel-cell" style="min-height: @imagesHeight; @ImageOnlyImageHeight">220 @{221 string newWindow = column.Button.NewWindow ? "target='_blank'" : "";222223 bool clickableBlock = !string.IsNullOrWhiteSpace(column.Button.ButtonLink) && _data.Clickable;224 string clickableClass = clickableBlock ? "cta-paragraph__container--clickable" : "";225226 double ColumnAmount = colDisplay;227 double ColumnWidthSize = 1/ColumnAmount;228 }229230 @CTAParagraphImage(231 column.Image,232 false,233 null,234 false,235 _data.Fullwidth,236 imagesHeight,237 ColumnWidthSize238 )239 @CTAParagraphContent(240 column.Header,241 null,242 column.Content,243 column.Button,244 column.Image,245 false246 )247248 @if (clickableBlock)249 {250 <a href="@column.Button.ButtonLink" class="cta-paragraph__clickable" @newWindow></a>251 }252 </section>253254 </div>255 }256 </section>257 }258 else if (colDisplay > amountColumns)259 {260 <div>Error: you cant display columns more than you filled in the backend</div>261 }262 }263264 @functions{265 // Check if this carousel contains only images (logo slider)266 bool checkOnlyImages(Carousel _data)267 {268269 int amountColumns = _data.CarouselItems.Count; // Amount of the columns in backend, filled by user270 int emptyColumn = 0;271272 // Loop through all the columns273 foreach (var column in _data.CarouselItems)274 {275 // If button is empty AND content is empty AND header is empty => this is img only276 if (string.IsNullOrWhiteSpace(column.Button.ButtonText) && string.IsNullOrWhiteSpace(column.Content.Text) && string.IsNullOrWhiteSpace(column.Header.HeaderFormatted()))277 {278 emptyColumn++;279 }280 }281282 bool emptyColumnResult = emptyColumn == amountColumns ? true : false;283284 return emptyColumnResult;285286 }287 }288
    Error executing template "Designs/Jerome_generated/Paragraph/Carousel.cshtml"System.NullReferenceException: Object reference not set to an instance of an object.at CompiledRazorTemplates.Dynamic.RazorEngine_f63a1657b9cb4fe99ac580fe728a97c7.Execute() in D:\virtual_hosts\bluedeskCorporate\files\Templates\Designs\Jerome_generated\Paragraph\Carousel.cshtml:line 17at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)at RazorEngine.Templating.RazorEngineCore.RunTemplate(ICompiledTemplate template, TextWriter writer, Object model, DynamicViewBag viewBag)at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)at RazorEngine.Templating.DynamicWrapperService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.b__0(TextWriter writer)at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)at RazorEngine.Templating.RazorEngineServiceExtensions.RunCompile(IRazorEngineService service, String name, Type modelType, Object model, DynamicViewBag viewBag)at RazorEngine.Templating.RazorEngineServiceExtensions.RunCompile(IRazorEngineService service, ITemplateSource templateSource, String name, Type modelType, Object model, DynamicViewBag viewBag)at Dynamicweb.Rendering.Template.RenderRazorTemplate() in E:\Agent\_work\169\s\06 - Dynamicweb Host\Dynamicweb\Dynamicweb-9.9\Dynamicweb\Rendering\Template.cs:line 902
    1 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2 @using Dynamicweb; 3 @using Dynamicweb.Content.Items; 4 @using Bluedesk.DynamicWeb.ItemTypes; 5 @using Bluedesk.DynamicWeb.ItemTypes.Pages; 6 @using Bluedesk.Tools.DynamicWeb.ExtensionMethods; 7 @using Bluedesk.Tools.Generic.ExtensionMethods 8 @using System.Linq; 9 @using Dynamicweb.Content; 10 11 <!-- FIX NEEDED: behaviour when all the items are full height images (for instance logo slider)?? --> 12 13 @{ 14 Carousel _data = ItemManager.Storage.GetById<Carousel>(Pageview.CurrentParagraph.ItemId ?? "0"); 15 16 var paragraphID = Pageview.CurrentParagraph.ID; 17 int amountColumns = _data.CarouselItems.Count; // Amount of the columns in backend, filled by user 18 var classFullWidth = !_data.Fullwidth ? "container" : "w-full"; // If slider or multicolumn has to be in container or full width of the page 19 } 20 21 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 22 @using Dynamicweb; 23 @using Dynamicweb.Content.Items; 24 @using Bluedesk.DynamicWeb.ItemTypes; 25 26 27 @{ 28 string fullWidthContainerClass = _data.Fullwidth ? "" : "container"; 29 30 string backgroundClass = !string.IsNullOrWhiteSpace(_data.BackgroundConfiguration.BackgroundClass) ? string.Format("bg-{0}", _data.BackgroundConfiguration.BackgroundClass) : ""; 31 string backgroundStyle = !string.IsNullOrWhiteSpace(_data.BackgroundConfiguration.BackgroundColor) ? $"background-color: {_data.BackgroundConfiguration.BackgroundColor}; " : ""; 32 backgroundStyle += !string.IsNullOrWhiteSpace(_data.BackgroundConfiguration.BackgroundImage) ? $"background-image: url({_data.BackgroundConfiguration.BackgroundImage}); " : ""; 33 } 34 35 36 @functions { 37 string getbackgroundclass(string backgroundClass) 38 { 39 return !string.IsNullOrWhiteSpace(backgroundClass) ? string.Format("bg-{0}" ,backgroundClass) : ""; 40 } 41 } 42 43 @helper CTAParagraphImage(ParagraphImageResizable Image, bool ImageAsBackground, string ImagePosition, bool ParallaxImage, bool Fullwidth, string imagesHeight, double ColumnWidthSize) 44 { 45 if (!string.IsNullOrWhiteSpace(Image.Image)) 46 { 47 48 string image = !string.IsNullOrWhiteSpace(Image.Image) ? Image.Image : null; 49 imagesHeight = !string.IsNullOrWhiteSpace(imagesHeight) ? "height: " + imagesHeight + ";" : ""; 50 51 string imageParrallax = ParallaxImage ? "rellax" : ""; 52 string imageAsBackground = ImageAsBackground ? "cta-paragraph__image--is-background" : ""; 53 double imageWidth = 2000; 54 55 imageWidth = Fullwidth ? imageWidth : 1200; 56 imageWidth = imageWidth*ColumnWidthSize; 57 58 string strImageWidth = imageWidth + "px"; 59 string strImageWidthSize = imageWidth + "w"; 60 61 string ImageUrl = "/Admin/Public/GetImage.ashx?Image=" + image + "&Crop=0&Compression=80"; 62 63 if (!string.IsNullOrWhiteSpace(Image.Image)) 64 { 65 <figure class="cta-paragraph__image-container @imageAsBackground @Image.PositionY @Image.PositionX" style="@imagesHeight"> 66 67 <picture class="cta-paragraph__image @Image.BackgroundSize @imageParrallax"> 68 <source media="(max-width: 400px)" srcset="@ImageUrl&Width=400"> 69 <source media="(max-width: 994px)" srcset="@ImageUrl&Width=994"> 70 <img src="@ImageUrl&Width=@imageWidth" alt="@Image.ImageAlt" class="cta-paragraph__image @Image.BackgroundSize @imageParrallax"> 71 </picture> 72 73 </figure> 74 } 75 } 76 } 77 78 79 @helper CTAParagraphContent(ParagraphHeader Header, ParagraphHeader SubHeader, ParagraphContent Content, CTAButton Button, ParagraphImage Image, bool strCenterVertical) 80 { 81 82 bool hasImage = !string.IsNullOrWhiteSpace(Image.Image) ? true : false; 83 string noImageClass = hasImage ? "" : "no-image"; 84 85 string centerTextClass = strCenterVertical ? "text-center" : ""; 86 string centerContent = !string.IsNullOrWhiteSpace(Image.Image) ? "" : "cta-paragraph__content--center"; 87 88 string buttonIconClass = Pageview.Area.Item["Global_button_icon"] != null ? Pageview.Area.Item["Global_button_icon"].ToString().Replace("+", " ") : "fal fa-arrow-right"; 89 90 <style> 91 .cta-paragraph__container { 92 height: 100% !important; /* Temp Hack to solve iPhone bug.. */ 93 } 94 </style> 95 96 if (!string.IsNullOrWhiteSpace(Button.ButtonText) || !string.IsNullOrWhiteSpace(Content.Text) || !string.IsNullOrWhiteSpace(Header.HeaderFormatted("cta-paragraph__header"))) 97 { 98 <section class="cta-paragraph__content @centerContent @noImageClass"> 99100 <article class="cta-paragraph__content-container @centerTextClass @noImageClass">101102 @if (!string.IsNullOrWhiteSpace(Header.HeaderFormatted("cta-paragraph__header")))103 {104 <header class="cta-paragraph__header @centerTextClass">105 @if (SubHeader != null)106 {107 @SubHeader.HeaderFormatted("cta-paragraph__subheader")108 }109 @Header.HeaderFormatted("cta-paragraph__header")110 </header>111 }112113 @if (!string.IsNullOrWhiteSpace(Content.Text))114 {115 <div class="cta-paragraph__text @centerTextClass">@Content.Text</div>116 }117118 </article>119120 @if (!string.IsNullOrWhiteSpace(Button.ButtonLink) && !string.IsNullOrWhiteSpace(Button.ButtonText))121 {122 <a href="@Button.ButtonLink" class="btn cta-paragraph__btn @Button.Configuration.ButtonClass">123 <span class="btn__text cta-paragraph__btn-label">@Button.ButtonText</span>124 <i class="btn__icon cta-paragraph__btn-icon @buttonIconClass"></i>125 </a>126 }127128 </section>129130 }131132 }133134135 @if (amountColumns > 0)136 {137 <div class="multicolumn overflow-hidden @backgroundClass @_data.CssClass" data-paragraphid="@paragraphID" id="@paragraphID">138 <div class="@classFullWidth">@RenderContentArea(_data)</div>139 </div>140 }141142 @helper RenderContentArea(Carousel _data)143 {144 int amountColumns = _data.CarouselItems.Count; // Amount of the columns in backend, filled by user145 var buttonIconClass = Pageview.Area.Item["Global_button_icon"] != null ? Pageview.Area.Item["Global_button_icon"].ToString().Replace("+", " ") : "fal fa-arrow-right";146147 string centerTextClass = _data.CenterText ? "items-center text-center" : "items-start text-left";148149 /* Specific for Carousel */150151 int colDisplay = _data.ColumnsDisplay; // Amount of displayed column within one screen152153 bool fullWidth = _data.Fullwidth; // If slider or multicolumn has to be in container or full widthof the page154 bool infiniteLoop = _data.Infinite;155 bool autoPlay = _data.AutoPlay;156 bool controls = _data.AddControls;157 bool duration = _data.Duration;158 bool showDots = _data.ShowDots; // If slider or multicolumn has to be in container or full widthof the page159 int colAmount = 1;160161 bool imagesOnlyBool = checkOnlyImages(_data); // Check if this carousel contains only images (logo slider)162163 if (!string.IsNullOrWhiteSpace(@_data.Header.HeaderFormatted()))164 {165 <header class="multicolumn__header-wrapper">166 @_data.Header.HeaderFormatted("multicolumn__header")167 </header>168 }169170 string carouselHeight = "auto";171172 if (imagesOnlyBool && _data.ImageHeight != 0)173 {174 carouselHeight = _data.ImageHeight.ToString() + "px";175 }176177 if ((colDisplay <= amountColumns) && (colDisplay != 0))178 {179 string flexBasis = 100 / @colDisplay + "%";180181 <section class="carousel multicolumn"182 data-columns="@colAmount"183 data-dots="@showDots"184 data-loop="@infiniteLoop"185 data-autoplay="@autoPlay"186 data-controls="@controls"187 data-duration="@duration"188 style="height: @carouselHeight;">189190 @foreach (var column in _data.CarouselItems)191 {192193 bool hasContent = !string.IsNullOrWhiteSpace(column.Button.ButtonText) || !string.IsNullOrWhiteSpace(column.Content.Text) || !string.IsNullOrWhiteSpace(column.Header.HeaderFormatted());194195 string image = column.Image.Image;196 string imagesHeight = _data.ImageHeight == 0 ? "auto" : _data.ImageHeight.ToString() + "px";197 string ImageContainerFixed = hasContent ? "cta-paragraph__image-container--fixed" : "";198 string ImageAsBackground = (column.BackgroundConfiguration.ConfigurationName == "Image as Background") ? "cta-paragraph__image--is-background" : "";199200 string coverImage = "";201202 string figureHeight = !hasContent ? "flex-grow:1" : "height:" + imagesHeight;203 string TempClass = imagesOnlyBool ? "imageOnly" : "hasContent";204 string ImageOnlyImageHeight = imagesOnlyBool ? "height:" + imagesHeight + ";" : "height:auto;";205206 if (!imagesOnlyBool)207 {208 imagesHeight = hasContent ? imagesHeight : imagesHeight = "100%";209 }210211 /*This is work around created by Alla to enable cover mode for stand alone pictures*/212 if (!hasContent && column.Image.BackgroundSize == "bg-cover")213 {214 coverImage = "height:100%;";215 }216217 <div class="carousel-cell-wrap" style="display: flex; min-height:100%; @ImageOnlyImageHeight width: @flexBasis; @coverImage">218219 <section class="cta-paragraph carousel-cell" style="min-height: @imagesHeight; @ImageOnlyImageHeight">220 @{221 string newWindow = column.Button.NewWindow ? "target='_blank'" : "";222223 bool clickableBlock = !string.IsNullOrWhiteSpace(column.Button.ButtonLink) && _data.Clickable;224 string clickableClass = clickableBlock ? "cta-paragraph__container--clickable" : "";225226 double ColumnAmount = colDisplay;227 double ColumnWidthSize = 1/ColumnAmount;228 }229230 @CTAParagraphImage(231 column.Image,232 false,233 null,234 false,235 _data.Fullwidth,236 imagesHeight,237 ColumnWidthSize238 )239 @CTAParagraphContent(240 column.Header,241 null,242 column.Content,243 column.Button,244 column.Image,245 false246 )247248 @if (clickableBlock)249 {250 <a href="@column.Button.ButtonLink" class="cta-paragraph__clickable" @newWindow></a>251 }252 </section>253254 </div>255 }256 </section>257 }258 else if (colDisplay > amountColumns)259 {260 <div>Error: you cant display columns more than you filled in the backend</div>261 }262 }263264 @functions{265 // Check if this carousel contains only images (logo slider)266 bool checkOnlyImages(Carousel _data)267 {268269 int amountColumns = _data.CarouselItems.Count; // Amount of the columns in backend, filled by user270 int emptyColumn = 0;271272 // Loop through all the columns273 foreach (var column in _data.CarouselItems)274 {275 // If button is empty AND content is empty AND header is empty => this is img only276 if (string.IsNullOrWhiteSpace(column.Button.ButtonText) && string.IsNullOrWhiteSpace(column.Content.Text) && string.IsNullOrWhiteSpace(column.Header.HeaderFormatted()))277 {278 emptyColumn++;279 }280 }281282 bool emptyColumnResult = emptyColumn == amountColumns ? true : false;283284 return emptyColumnResult;285286 }287 }288
    Error executing template "Designs/Jerome_generated/Paragraph/Carousel.cshtml"System.NullReferenceException: Object reference not set to an instance of an object.at CompiledRazorTemplates.Dynamic.RazorEngine_f63a1657b9cb4fe99ac580fe728a97c7.Execute() in D:\virtual_hosts\bluedeskCorporate\files\Templates\Designs\Jerome_generated\Paragraph\Carousel.cshtml:line 17at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)at RazorEngine.Templating.RazorEngineCore.RunTemplate(ICompiledTemplate template, TextWriter writer, Object model, DynamicViewBag viewBag)at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)at RazorEngine.Templating.DynamicWrapperService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.b__0(TextWriter writer)at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)at RazorEngine.Templating.RazorEngineServiceExtensions.RunCompile(IRazorEngineService service, String name, Type modelType, Object model, DynamicViewBag viewBag)at RazorEngine.Templating.RazorEngineServiceExtensions.RunCompile(IRazorEngineService service, ITemplateSource templateSource, String name, Type modelType, Object model, DynamicViewBag viewBag)at Dynamicweb.Rendering.Template.RenderRazorTemplate() in E:\Agent\_work\169\s\06 - Dynamicweb Host\Dynamicweb\Dynamicweb-9.9\Dynamicweb\Rendering\Template.cs:line 902
    1 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2 @using Dynamicweb; 3 @using Dynamicweb.Content.Items; 4 @using Bluedesk.DynamicWeb.ItemTypes; 5 @using Bluedesk.DynamicWeb.ItemTypes.Pages; 6 @using Bluedesk.Tools.DynamicWeb.ExtensionMethods; 7 @using Bluedesk.Tools.Generic.ExtensionMethods 8 @using System.Linq; 9 @using Dynamicweb.Content; 10 11 <!-- FIX NEEDED: behaviour when all the items are full height images (for instance logo slider)?? --> 12 13 @{ 14 Carousel _data = ItemManager.Storage.GetById<Carousel>(Pageview.CurrentParagraph.ItemId ?? "0"); 15 16 var paragraphID = Pageview.CurrentParagraph.ID; 17 int amountColumns = _data.CarouselItems.Count; // Amount of the columns in backend, filled by user 18 var classFullWidth = !_data.Fullwidth ? "container" : "w-full"; // If slider or multicolumn has to be in container or full width of the page 19 } 20 21 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 22 @using Dynamicweb; 23 @using Dynamicweb.Content.Items; 24 @using Bluedesk.DynamicWeb.ItemTypes; 25 26 27 @{ 28 string fullWidthContainerClass = _data.Fullwidth ? "" : "container"; 29 30 string backgroundClass = !string.IsNullOrWhiteSpace(_data.BackgroundConfiguration.BackgroundClass) ? string.Format("bg-{0}", _data.BackgroundConfiguration.BackgroundClass) : ""; 31 string backgroundStyle = !string.IsNullOrWhiteSpace(_data.BackgroundConfiguration.BackgroundColor) ? $"background-color: {_data.BackgroundConfiguration.BackgroundColor}; " : ""; 32 backgroundStyle += !string.IsNullOrWhiteSpace(_data.BackgroundConfiguration.BackgroundImage) ? $"background-image: url({_data.BackgroundConfiguration.BackgroundImage}); " : ""; 33 } 34 35 36 @functions { 37 string getbackgroundclass(string backgroundClass) 38 { 39 return !string.IsNullOrWhiteSpace(backgroundClass) ? string.Format("bg-{0}" ,backgroundClass) : ""; 40 } 41 } 42 43 @helper CTAParagraphImage(ParagraphImageResizable Image, bool ImageAsBackground, string ImagePosition, bool ParallaxImage, bool Fullwidth, string imagesHeight, double ColumnWidthSize) 44 { 45 if (!string.IsNullOrWhiteSpace(Image.Image)) 46 { 47 48 string image = !string.IsNullOrWhiteSpace(Image.Image) ? Image.Image : null; 49 imagesHeight = !string.IsNullOrWhiteSpace(imagesHeight) ? "height: " + imagesHeight + ";" : ""; 50 51 string imageParrallax = ParallaxImage ? "rellax" : ""; 52 string imageAsBackground = ImageAsBackground ? "cta-paragraph__image--is-background" : ""; 53 double imageWidth = 2000; 54 55 imageWidth = Fullwidth ? imageWidth : 1200; 56 imageWidth = imageWidth*ColumnWidthSize; 57 58 string strImageWidth = imageWidth + "px"; 59 string strImageWidthSize = imageWidth + "w"; 60 61 string ImageUrl = "/Admin/Public/GetImage.ashx?Image=" + image + "&Crop=0&Compression=80"; 62 63 if (!string.IsNullOrWhiteSpace(Image.Image)) 64 { 65 <figure class="cta-paragraph__image-container @imageAsBackground @Image.PositionY @Image.PositionX" style="@imagesHeight"> 66 67 <picture class="cta-paragraph__image @Image.BackgroundSize @imageParrallax"> 68 <source media="(max-width: 400px)" srcset="@ImageUrl&Width=400"> 69 <source media="(max-width: 994px)" srcset="@ImageUrl&Width=994"> 70 <img src="@ImageUrl&Width=@imageWidth" alt="@Image.ImageAlt" class="cta-paragraph__image @Image.BackgroundSize @imageParrallax"> 71 </picture> 72 73 </figure> 74 } 75 } 76 } 77 78 79 @helper CTAParagraphContent(ParagraphHeader Header, ParagraphHeader SubHeader, ParagraphContent Content, CTAButton Button, ParagraphImage Image, bool strCenterVertical) 80 { 81 82 bool hasImage = !string.IsNullOrWhiteSpace(Image.Image) ? true : false; 83 string noImageClass = hasImage ? "" : "no-image"; 84 85 string centerTextClass = strCenterVertical ? "text-center" : ""; 86 string centerContent = !string.IsNullOrWhiteSpace(Image.Image) ? "" : "cta-paragraph__content--center"; 87 88 string buttonIconClass = Pageview.Area.Item["Global_button_icon"] != null ? Pageview.Area.Item["Global_button_icon"].ToString().Replace("+", " ") : "fal fa-arrow-right"; 89 90 <style> 91 .cta-paragraph__container { 92 height: 100% !important; /* Temp Hack to solve iPhone bug.. */ 93 } 94 </style> 95 96 if (!string.IsNullOrWhiteSpace(Button.ButtonText) || !string.IsNullOrWhiteSpace(Content.Text) || !string.IsNullOrWhiteSpace(Header.HeaderFormatted("cta-paragraph__header"))) 97 { 98 <section class="cta-paragraph__content @centerContent @noImageClass"> 99100 <article class="cta-paragraph__content-container @centerTextClass @noImageClass">101102 @if (!string.IsNullOrWhiteSpace(Header.HeaderFormatted("cta-paragraph__header")))103 {104 <header class="cta-paragraph__header @centerTextClass">105 @if (SubHeader != null)106 {107 @SubHeader.HeaderFormatted("cta-paragraph__subheader")108 }109 @Header.HeaderFormatted("cta-paragraph__header")110 </header>111 }112113 @if (!string.IsNullOrWhiteSpace(Content.Text))114 {115 <div class="cta-paragraph__text @centerTextClass">@Content.Text</div>116 }117118 </article>119120 @if (!string.IsNullOrWhiteSpace(Button.ButtonLink) && !string.IsNullOrWhiteSpace(Button.ButtonText))121 {122 <a href="@Button.ButtonLink" class="btn cta-paragraph__btn @Button.Configuration.ButtonClass">123 <span class="btn__text cta-paragraph__btn-label">@Button.ButtonText</span>124 <i class="btn__icon cta-paragraph__btn-icon @buttonIconClass"></i>125 </a>126 }127128 </section>129130 }131132 }133134135 @if (amountColumns > 0)136 {137 <div class="multicolumn overflow-hidden @backgroundClass @_data.CssClass" data-paragraphid="@paragraphID" id="@paragraphID">138 <div class="@classFullWidth">@RenderContentArea(_data)</div>139 </div>140 }141142 @helper RenderContentArea(Carousel _data)143 {144 int amountColumns = _data.CarouselItems.Count; // Amount of the columns in backend, filled by user145 var buttonIconClass = Pageview.Area.Item["Global_button_icon"] != null ? Pageview.Area.Item["Global_button_icon"].ToString().Replace("+", " ") : "fal fa-arrow-right";146147 string centerTextClass = _data.CenterText ? "items-center text-center" : "items-start text-left";148149 /* Specific for Carousel */150151 int colDisplay = _data.ColumnsDisplay; // Amount of displayed column within one screen152153 bool fullWidth = _data.Fullwidth; // If slider or multicolumn has to be in container or full widthof the page154 bool infiniteLoop = _data.Infinite;155 bool autoPlay = _data.AutoPlay;156 bool controls = _data.AddControls;157 bool duration = _data.Duration;158 bool showDots = _data.ShowDots; // If slider or multicolumn has to be in container or full widthof the page159 int colAmount = 1;160161 bool imagesOnlyBool = checkOnlyImages(_data); // Check if this carousel contains only images (logo slider)162163 if (!string.IsNullOrWhiteSpace(@_data.Header.HeaderFormatted()))164 {165 <header class="multicolumn__header-wrapper">166 @_data.Header.HeaderFormatted("multicolumn__header")167 </header>168 }169170 string carouselHeight = "auto";171172 if (imagesOnlyBool && _data.ImageHeight != 0)173 {174 carouselHeight = _data.ImageHeight.ToString() + "px";175 }176177 if ((colDisplay <= amountColumns) && (colDisplay != 0))178 {179 string flexBasis = 100 / @colDisplay + "%";180181 <section class="carousel multicolumn"182 data-columns="@colAmount"183 data-dots="@showDots"184 data-loop="@infiniteLoop"185 data-autoplay="@autoPlay"186 data-controls="@controls"187 data-duration="@duration"188 style="height: @carouselHeight;">189190 @foreach (var column in _data.CarouselItems)191 {192193 bool hasContent = !string.IsNullOrWhiteSpace(column.Button.ButtonText) || !string.IsNullOrWhiteSpace(column.Content.Text) || !string.IsNullOrWhiteSpace(column.Header.HeaderFormatted());194195 string image = column.Image.Image;196 string imagesHeight = _data.ImageHeight == 0 ? "auto" : _data.ImageHeight.ToString() + "px";197 string ImageContainerFixed = hasContent ? "cta-paragraph__image-container--fixed" : "";198 string ImageAsBackground = (column.BackgroundConfiguration.ConfigurationName == "Image as Background") ? "cta-paragraph__image--is-background" : "";199200 string coverImage = "";201202 string figureHeight = !hasContent ? "flex-grow:1" : "height:" + imagesHeight;203 string TempClass = imagesOnlyBool ? "imageOnly" : "hasContent";204 string ImageOnlyImageHeight = imagesOnlyBool ? "height:" + imagesHeight + ";" : "height:auto;";205206 if (!imagesOnlyBool)207 {208 imagesHeight = hasContent ? imagesHeight : imagesHeight = "100%";209 }210211 /*This is work around created by Alla to enable cover mode for stand alone pictures*/212 if (!hasContent && column.Image.BackgroundSize == "bg-cover")213 {214 coverImage = "height:100%;";215 }216217 <div class="carousel-cell-wrap" style="display: flex; min-height:100%; @ImageOnlyImageHeight width: @flexBasis; @coverImage">218219 <section class="cta-paragraph carousel-cell" style="min-height: @imagesHeight; @ImageOnlyImageHeight">220 @{221 string newWindow = column.Button.NewWindow ? "target='_blank'" : "";222223 bool clickableBlock = !string.IsNullOrWhiteSpace(column.Button.ButtonLink) && _data.Clickable;224 string clickableClass = clickableBlock ? "cta-paragraph__container--clickable" : "";225226 double ColumnAmount = colDisplay;227 double ColumnWidthSize = 1/ColumnAmount;228 }229230 @CTAParagraphImage(231 column.Image,232 false,233 null,234 false,235 _data.Fullwidth,236 imagesHeight,237 ColumnWidthSize238 )239 @CTAParagraphContent(240 column.Header,241 null,242 column.Content,243 column.Button,244 column.Image,245 false246 )247248 @if (clickableBlock)249 {250 <a href="@column.Button.ButtonLink" class="cta-paragraph__clickable" @newWindow></a>251 }252 </section>253254 </div>255 }256 </section>257 }258 else if (colDisplay > amountColumns)259 {260 <div>Error: you cant display columns more than you filled in the backend</div>261 }262 }263264 @functions{265 // Check if this carousel contains only images (logo slider)266 bool checkOnlyImages(Carousel _data)267 {268269 int amountColumns = _data.CarouselItems.Count; // Amount of the columns in backend, filled by user270 int emptyColumn = 0;271272 // Loop through all the columns273 foreach (var column in _data.CarouselItems)274 {275 // If button is empty AND content is empty AND header is empty => this is img only276 if (string.IsNullOrWhiteSpace(column.Button.ButtonText) && string.IsNullOrWhiteSpace(column.Content.Text) && string.IsNullOrWhiteSpace(column.Header.HeaderFormatted()))277 {278 emptyColumn++;279 }280 }281282 bool emptyColumnResult = emptyColumn == amountColumns ? true : false;283284 return emptyColumnResult;285286 }287 }288
    Error executing template "Designs/Jerome_generated/Paragraph/Carousel.cshtml"System.NullReferenceException: Object reference not set to an instance of an object.at CompiledRazorTemplates.Dynamic.RazorEngine_f63a1657b9cb4fe99ac580fe728a97c7.Execute() in D:\virtual_hosts\bluedeskCorporate\files\Templates\Designs\Jerome_generated\Paragraph\Carousel.cshtml:line 17at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)at RazorEngine.Templating.RazorEngineCore.RunTemplate(ICompiledTemplate template, TextWriter writer, Object model, DynamicViewBag viewBag)at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)at RazorEngine.Templating.DynamicWrapperService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.b__0(TextWriter writer)at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)at RazorEngine.Templating.RazorEngineServiceExtensions.RunCompile(IRazorEngineService service, String name, Type modelType, Object model, DynamicViewBag viewBag)at RazorEngine.Templating.RazorEngineServiceExtensions.RunCompile(IRazorEngineService service, ITemplateSource templateSource, String name, Type modelType, Object model, DynamicViewBag viewBag)at Dynamicweb.Rendering.Template.RenderRazorTemplate() in E:\Agent\_work\169\s\06 - Dynamicweb Host\Dynamicweb\Dynamicweb-9.9\Dynamicweb\Rendering\Template.cs:line 902
    1 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2 @using Dynamicweb; 3 @using Dynamicweb.Content.Items; 4 @using Bluedesk.DynamicWeb.ItemTypes; 5 @using Bluedesk.DynamicWeb.ItemTypes.Pages; 6 @using Bluedesk.Tools.DynamicWeb.ExtensionMethods; 7 @using Bluedesk.Tools.Generic.ExtensionMethods 8 @using System.Linq; 9 @using Dynamicweb.Content; 10 11 <!-- FIX NEEDED: behaviour when all the items are full height images (for instance logo slider)?? --> 12 13 @{ 14 Carousel _data = ItemManager.Storage.GetById<Carousel>(Pageview.CurrentParagraph.ItemId ?? "0"); 15 16 var paragraphID = Pageview.CurrentParagraph.ID; 17 int amountColumns = _data.CarouselItems.Count; // Amount of the columns in backend, filled by user 18 var classFullWidth = !_data.Fullwidth ? "container" : "w-full"; // If slider or multicolumn has to be in container or full width of the page 19 } 20 21 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 22 @using Dynamicweb; 23 @using Dynamicweb.Content.Items; 24 @using Bluedesk.DynamicWeb.ItemTypes; 25 26 27 @{ 28 string fullWidthContainerClass = _data.Fullwidth ? "" : "container"; 29 30 string backgroundClass = !string.IsNullOrWhiteSpace(_data.BackgroundConfiguration.BackgroundClass) ? string.Format("bg-{0}", _data.BackgroundConfiguration.BackgroundClass) : ""; 31 string backgroundStyle = !string.IsNullOrWhiteSpace(_data.BackgroundConfiguration.BackgroundColor) ? $"background-color: {_data.BackgroundConfiguration.BackgroundColor}; " : ""; 32 backgroundStyle += !string.IsNullOrWhiteSpace(_data.BackgroundConfiguration.BackgroundImage) ? $"background-image: url({_data.BackgroundConfiguration.BackgroundImage}); " : ""; 33 } 34 35 36 @functions { 37 string getbackgroundclass(string backgroundClass) 38 { 39 return !string.IsNullOrWhiteSpace(backgroundClass) ? string.Format("bg-{0}" ,backgroundClass) : ""; 40 } 41 } 42 43 @helper CTAParagraphImage(ParagraphImageResizable Image, bool ImageAsBackground, string ImagePosition, bool ParallaxImage, bool Fullwidth, string imagesHeight, double ColumnWidthSize) 44 { 45 if (!string.IsNullOrWhiteSpace(Image.Image)) 46 { 47 48 string image = !string.IsNullOrWhiteSpace(Image.Image) ? Image.Image : null; 49 imagesHeight = !string.IsNullOrWhiteSpace(imagesHeight) ? "height: " + imagesHeight + ";" : ""; 50 51 string imageParrallax = ParallaxImage ? "rellax" : ""; 52 string imageAsBackground = ImageAsBackground ? "cta-paragraph__image--is-background" : ""; 53 double imageWidth = 2000; 54 55 imageWidth = Fullwidth ? imageWidth : 1200; 56 imageWidth = imageWidth*ColumnWidthSize; 57 58 string strImageWidth = imageWidth + "px"; 59 string strImageWidthSize = imageWidth + "w"; 60 61 string ImageUrl = "/Admin/Public/GetImage.ashx?Image=" + image + "&Crop=0&Compression=80"; 62 63 if (!string.IsNullOrWhiteSpace(Image.Image)) 64 { 65 <figure class="cta-paragraph__image-container @imageAsBackground @Image.PositionY @Image.PositionX" style="@imagesHeight"> 66 67 <picture class="cta-paragraph__image @Image.BackgroundSize @imageParrallax"> 68 <source media="(max-width: 400px)" srcset="@ImageUrl&Width=400"> 69 <source media="(max-width: 994px)" srcset="@ImageUrl&Width=994"> 70 <img src="@ImageUrl&Width=@imageWidth" alt="@Image.ImageAlt" class="cta-paragraph__image @Image.BackgroundSize @imageParrallax"> 71 </picture> 72 73 </figure> 74 } 75 } 76 } 77 78 79 @helper CTAParagraphContent(ParagraphHeader Header, ParagraphHeader SubHeader, ParagraphContent Content, CTAButton Button, ParagraphImage Image, bool strCenterVertical) 80 { 81 82 bool hasImage = !string.IsNullOrWhiteSpace(Image.Image) ? true : false; 83 string noImageClass = hasImage ? "" : "no-image"; 84 85 string centerTextClass = strCenterVertical ? "text-center" : ""; 86 string centerContent = !string.IsNullOrWhiteSpace(Image.Image) ? "" : "cta-paragraph__content--center"; 87 88 string buttonIconClass = Pageview.Area.Item["Global_button_icon"] != null ? Pageview.Area.Item["Global_button_icon"].ToString().Replace("+", " ") : "fal fa-arrow-right"; 89 90 <style> 91 .cta-paragraph__container { 92 height: 100% !important; /* Temp Hack to solve iPhone bug.. */ 93 } 94 </style> 95 96 if (!string.IsNullOrWhiteSpace(Button.ButtonText) || !string.IsNullOrWhiteSpace(Content.Text) || !string.IsNullOrWhiteSpace(Header.HeaderFormatted("cta-paragraph__header"))) 97 { 98 <section class="cta-paragraph__content @centerContent @noImageClass"> 99100 <article class="cta-paragraph__content-container @centerTextClass @noImageClass">101102 @if (!string.IsNullOrWhiteSpace(Header.HeaderFormatted("cta-paragraph__header")))103 {104 <header class="cta-paragraph__header @centerTextClass">105 @if (SubHeader != null)106 {107 @SubHeader.HeaderFormatted("cta-paragraph__subheader")108 }109 @Header.HeaderFormatted("cta-paragraph__header")110 </header>111 }112113 @if (!string.IsNullOrWhiteSpace(Content.Text))114 {115 <div class="cta-paragraph__text @centerTextClass">@Content.Text</div>116 }117118 </article>119120 @if (!string.IsNullOrWhiteSpace(Button.ButtonLink) && !string.IsNullOrWhiteSpace(Button.ButtonText))121 {122 <a href="@Button.ButtonLink" class="btn cta-paragraph__btn @Button.Configuration.ButtonClass">123 <span class="btn__text cta-paragraph__btn-label">@Button.ButtonText</span>124 <i class="btn__icon cta-paragraph__btn-icon @buttonIconClass"></i>125 </a>126 }127128 </section>129130 }131132 }133134135 @if (amountColumns > 0)136 {137 <div class="multicolumn overflow-hidden @backgroundClass @_data.CssClass" data-paragraphid="@paragraphID" id="@paragraphID">138 <div class="@classFullWidth">@RenderContentArea(_data)</div>139 </div>140 }141142 @helper RenderContentArea(Carousel _data)143 {144 int amountColumns = _data.CarouselItems.Count; // Amount of the columns in backend, filled by user145 var buttonIconClass = Pageview.Area.Item["Global_button_icon"] != null ? Pageview.Area.Item["Global_button_icon"].ToString().Replace("+", " ") : "fal fa-arrow-right";146147 string centerTextClass = _data.CenterText ? "items-center text-center" : "items-start text-left";148149 /* Specific for Carousel */150151 int colDisplay = _data.ColumnsDisplay; // Amount of displayed column within one screen152153 bool fullWidth = _data.Fullwidth; // If slider or multicolumn has to be in container or full widthof the page154 bool infiniteLoop = _data.Infinite;155 bool autoPlay = _data.AutoPlay;156 bool controls = _data.AddControls;157 bool duration = _data.Duration;158 bool showDots = _data.ShowDots; // If slider or multicolumn has to be in container or full widthof the page159 int colAmount = 1;160161 bool imagesOnlyBool = checkOnlyImages(_data); // Check if this carousel contains only images (logo slider)162163 if (!string.IsNullOrWhiteSpace(@_data.Header.HeaderFormatted()))164 {165 <header class="multicolumn__header-wrapper">166 @_data.Header.HeaderFormatted("multicolumn__header")167 </header>168 }169170 string carouselHeight = "auto";171172 if (imagesOnlyBool && _data.ImageHeight != 0)173 {174 carouselHeight = _data.ImageHeight.ToString() + "px";175 }176177 if ((colDisplay <= amountColumns) && (colDisplay != 0))178 {179 string flexBasis = 100 / @colDisplay + "%";180181 <section class="carousel multicolumn"182 data-columns="@colAmount"183 data-dots="@showDots"184 data-loop="@infiniteLoop"185 data-autoplay="@autoPlay"186 data-controls="@controls"187 data-duration="@duration"188 style="height: @carouselHeight;">189190 @foreach (var column in _data.CarouselItems)191 {192193 bool hasContent = !string.IsNullOrWhiteSpace(column.Button.ButtonText) || !string.IsNullOrWhiteSpace(column.Content.Text) || !string.IsNullOrWhiteSpace(column.Header.HeaderFormatted());194195 string image = column.Image.Image;196 string imagesHeight = _data.ImageHeight == 0 ? "auto" : _data.ImageHeight.ToString() + "px";197 string ImageContainerFixed = hasContent ? "cta-paragraph__image-container--fixed" : "";198 string ImageAsBackground = (column.BackgroundConfiguration.ConfigurationName == "Image as Background") ? "cta-paragraph__image--is-background" : "";199200 string coverImage = "";201202 string figureHeight = !hasContent ? "flex-grow:1" : "height:" + imagesHeight;203 string TempClass = imagesOnlyBool ? "imageOnly" : "hasContent";204 string ImageOnlyImageHeight = imagesOnlyBool ? "height:" + imagesHeight + ";" : "height:auto;";205206 if (!imagesOnlyBool)207 {208 imagesHeight = hasContent ? imagesHeight : imagesHeight = "100%";209 }210211 /*This is work around created by Alla to enable cover mode for stand alone pictures*/212 if (!hasContent && column.Image.BackgroundSize == "bg-cover")213 {214 coverImage = "height:100%;";215 }216217 <div class="carousel-cell-wrap" style="display: flex; min-height:100%; @ImageOnlyImageHeight width: @flexBasis; @coverImage">218219 <section class="cta-paragraph carousel-cell" style="min-height: @imagesHeight; @ImageOnlyImageHeight">220 @{221 string newWindow = column.Button.NewWindow ? "target='_blank'" : "";222223 bool clickableBlock = !string.IsNullOrWhiteSpace(column.Button.ButtonLink) && _data.Clickable;224 string clickableClass = clickableBlock ? "cta-paragraph__container--clickable" : "";225226 double ColumnAmount = colDisplay;227 double ColumnWidthSize = 1/ColumnAmount;228 }229230 @CTAParagraphImage(231 column.Image,232 false,233 null,234 false,235 _data.Fullwidth,236 imagesHeight,237 ColumnWidthSize238 )239 @CTAParagraphContent(240 column.Header,241 null,242 column.Content,243 column.Button,244 column.Image,245 false246 )247248 @if (clickableBlock)249 {250 <a href="@column.Button.ButtonLink" class="cta-paragraph__clickable" @newWindow></a>251 }252 </section>253254 </div>255 }256 </section>257 }258 else if (colDisplay > amountColumns)259 {260 <div>Error: you cant display columns more than you filled in the backend</div>261 }262 }263264 @functions{265 // Check if this carousel contains only images (logo slider)266 bool checkOnlyImages(Carousel _data)267 {268269 int amountColumns = _data.CarouselItems.Count; // Amount of the columns in backend, filled by user270 int emptyColumn = 0;271272 // Loop through all the columns273 foreach (var column in _data.CarouselItems)274 {275 // If button is empty AND content is empty AND header is empty => this is img only276 if (string.IsNullOrWhiteSpace(column.Button.ButtonText) && string.IsNullOrWhiteSpace(column.Content.Text) && string.IsNullOrWhiteSpace(column.Header.HeaderFormatted()))277 {278 emptyColumn++;279 }280 }281282 bool emptyColumnResult = emptyColumn == amountColumns ? true : false;283284 return emptyColumnResult;285286 }287 }288
    Error executing template "Designs/Jerome_generated/Paragraph/Carousel.cshtml"System.NullReferenceException: Object reference not set to an instance of an object.at CompiledRazorTemplates.Dynamic.RazorEngine_f63a1657b9cb4fe99ac580fe728a97c7.Execute() in D:\virtual_hosts\bluedeskCorporate\files\Templates\Designs\Jerome_generated\Paragraph\Carousel.cshtml:line 17at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)at RazorEngine.Templating.RazorEngineCore.RunTemplate(ICompiledTemplate template, TextWriter writer, Object model, DynamicViewBag viewBag)at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)at RazorEngine.Templating.DynamicWrapperService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.b__0(TextWriter writer)at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)at RazorEngine.Templating.RazorEngineServiceExtensions.RunCompile(IRazorEngineService service, String name, Type modelType, Object model, DynamicViewBag viewBag)at RazorEngine.Templating.RazorEngineServiceExtensions.RunCompile(IRazorEngineService service, ITemplateSource templateSource, String name, Type modelType, Object model, DynamicViewBag viewBag)at Dynamicweb.Rendering.Template.RenderRazorTemplate() in E:\Agent\_work\169\s\06 - Dynamicweb Host\Dynamicweb\Dynamicweb-9.9\Dynamicweb\Rendering\Template.cs:line 902
    1 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2 @using Dynamicweb; 3 @using Dynamicweb.Content.Items; 4 @using Bluedesk.DynamicWeb.ItemTypes; 5 @using Bluedesk.DynamicWeb.ItemTypes.Pages; 6 @using Bluedesk.Tools.DynamicWeb.ExtensionMethods; 7 @using Bluedesk.Tools.Generic.ExtensionMethods 8 @using System.Linq; 9 @using Dynamicweb.Content; 10 11 <!-- FIX NEEDED: behaviour when all the items are full height images (for instance logo slider)?? --> 12 13 @{ 14 Carousel _data = ItemManager.Storage.GetById<Carousel>(Pageview.CurrentParagraph.ItemId ?? "0"); 15 16 var paragraphID = Pageview.CurrentParagraph.ID; 17 int amountColumns = _data.CarouselItems.Count; // Amount of the columns in backend, filled by user 18 var classFullWidth = !_data.Fullwidth ? "container" : "w-full"; // If slider or multicolumn has to be in container or full width of the page 19 } 20 21 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 22 @using Dynamicweb; 23 @using Dynamicweb.Content.Items; 24 @using Bluedesk.DynamicWeb.ItemTypes; 25 26 27 @{ 28 string fullWidthContainerClass = _data.Fullwidth ? "" : "container"; 29 30 string backgroundClass = !string.IsNullOrWhiteSpace(_data.BackgroundConfiguration.BackgroundClass) ? string.Format("bg-{0}", _data.BackgroundConfiguration.BackgroundClass) : ""; 31 string backgroundStyle = !string.IsNullOrWhiteSpace(_data.BackgroundConfiguration.BackgroundColor) ? $"background-color: {_data.BackgroundConfiguration.BackgroundColor}; " : ""; 32 backgroundStyle += !string.IsNullOrWhiteSpace(_data.BackgroundConfiguration.BackgroundImage) ? $"background-image: url({_data.BackgroundConfiguration.BackgroundImage}); " : ""; 33 } 34 35 36 @functions { 37 string getbackgroundclass(string backgroundClass) 38 { 39 return !string.IsNullOrWhiteSpace(backgroundClass) ? string.Format("bg-{0}" ,backgroundClass) : ""; 40 } 41 } 42 43 @helper CTAParagraphImage(ParagraphImageResizable Image, bool ImageAsBackground, string ImagePosition, bool ParallaxImage, bool Fullwidth, string imagesHeight, double ColumnWidthSize) 44 { 45 if (!string.IsNullOrWhiteSpace(Image.Image)) 46 { 47 48 string image = !string.IsNullOrWhiteSpace(Image.Image) ? Image.Image : null; 49 imagesHeight = !string.IsNullOrWhiteSpace(imagesHeight) ? "height: " + imagesHeight + ";" : ""; 50 51 string imageParrallax = ParallaxImage ? "rellax" : ""; 52 string imageAsBackground = ImageAsBackground ? "cta-paragraph__image--is-background" : ""; 53 double imageWidth = 2000; 54 55 imageWidth = Fullwidth ? imageWidth : 1200; 56 imageWidth = imageWidth*ColumnWidthSize; 57 58 string strImageWidth = imageWidth + "px"; 59 string strImageWidthSize = imageWidth + "w"; 60 61 string ImageUrl = "/Admin/Public/GetImage.ashx?Image=" + image + "&Crop=0&Compression=80"; 62 63 if (!string.IsNullOrWhiteSpace(Image.Image)) 64 { 65 <figure class="cta-paragraph__image-container @imageAsBackground @Image.PositionY @Image.PositionX" style="@imagesHeight"> 66 67 <picture class="cta-paragraph__image @Image.BackgroundSize @imageParrallax"> 68 <source media="(max-width: 400px)" srcset="@ImageUrl&Width=400"> 69 <source media="(max-width: 994px)" srcset="@ImageUrl&Width=994"> 70 <img src="@ImageUrl&Width=@imageWidth" alt="@Image.ImageAlt" class="cta-paragraph__image @Image.BackgroundSize @imageParrallax"> 71 </picture> 72 73 </figure> 74 } 75 } 76 } 77 78 79 @helper CTAParagraphContent(ParagraphHeader Header, ParagraphHeader SubHeader, ParagraphContent Content, CTAButton Button, ParagraphImage Image, bool strCenterVertical) 80 { 81 82 bool hasImage = !string.IsNullOrWhiteSpace(Image.Image) ? true : false; 83 string noImageClass = hasImage ? "" : "no-image"; 84 85 string centerTextClass = strCenterVertical ? "text-center" : ""; 86 string centerContent = !string.IsNullOrWhiteSpace(Image.Image) ? "" : "cta-paragraph__content--center"; 87 88 string buttonIconClass = Pageview.Area.Item["Global_button_icon"] != null ? Pageview.Area.Item["Global_button_icon"].ToString().Replace("+", " ") : "fal fa-arrow-right"; 89 90 <style> 91 .cta-paragraph__container { 92 height: 100% !important; /* Temp Hack to solve iPhone bug.. */ 93 } 94 </style> 95 96 if (!string.IsNullOrWhiteSpace(Button.ButtonText) || !string.IsNullOrWhiteSpace(Content.Text) || !string.IsNullOrWhiteSpace(Header.HeaderFormatted("cta-paragraph__header"))) 97 { 98 <section class="cta-paragraph__content @centerContent @noImageClass"> 99100 <article class="cta-paragraph__content-container @centerTextClass @noImageClass">101102 @if (!string.IsNullOrWhiteSpace(Header.HeaderFormatted("cta-paragraph__header")))103 {104 <header class="cta-paragraph__header @centerTextClass">105 @if (SubHeader != null)106 {107 @SubHeader.HeaderFormatted("cta-paragraph__subheader")108 }109 @Header.HeaderFormatted("cta-paragraph__header")110 </header>111 }112113 @if (!string.IsNullOrWhiteSpace(Content.Text))114 {115 <div class="cta-paragraph__text @centerTextClass">@Content.Text</div>116 }117118 </article>119120 @if (!string.IsNullOrWhiteSpace(Button.ButtonLink) && !string.IsNullOrWhiteSpace(Button.ButtonText))121 {122 <a href="@Button.ButtonLink" class="btn cta-paragraph__btn @Button.Configuration.ButtonClass">123 <span class="btn__text cta-paragraph__btn-label">@Button.ButtonText</span>124 <i class="btn__icon cta-paragraph__btn-icon @buttonIconClass"></i>125 </a>126 }127128 </section>129130 }131132 }133134135 @if (amountColumns > 0)136 {137 <div class="multicolumn overflow-hidden @backgroundClass @_data.CssClass" data-paragraphid="@paragraphID" id="@paragraphID">138 <div class="@classFullWidth">@RenderContentArea(_data)</div>139 </div>140 }141142 @helper RenderContentArea(Carousel _data)143 {144 int amountColumns = _data.CarouselItems.Count; // Amount of the columns in backend, filled by user145 var buttonIconClass = Pageview.Area.Item["Global_button_icon"] != null ? Pageview.Area.Item["Global_button_icon"].ToString().Replace("+", " ") : "fal fa-arrow-right";146147 string centerTextClass = _data.CenterText ? "items-center text-center" : "items-start text-left";148149 /* Specific for Carousel */150151 int colDisplay = _data.ColumnsDisplay; // Amount of displayed column within one screen152153 bool fullWidth = _data.Fullwidth; // If slider or multicolumn has to be in container or full widthof the page154 bool infiniteLoop = _data.Infinite;155 bool autoPlay = _data.AutoPlay;156 bool controls = _data.AddControls;157 bool duration = _data.Duration;158 bool showDots = _data.ShowDots; // If slider or multicolumn has to be in container or full widthof the page159 int colAmount = 1;160161 bool imagesOnlyBool = checkOnlyImages(_data); // Check if this carousel contains only images (logo slider)162163 if (!string.IsNullOrWhiteSpace(@_data.Header.HeaderFormatted()))164 {165 <header class="multicolumn__header-wrapper">166 @_data.Header.HeaderFormatted("multicolumn__header")167 </header>168 }169170 string carouselHeight = "auto";171172 if (imagesOnlyBool && _data.ImageHeight != 0)173 {174 carouselHeight = _data.ImageHeight.ToString() + "px";175 }176177 if ((colDisplay <= amountColumns) && (colDisplay != 0))178 {179 string flexBasis = 100 / @colDisplay + "%";180181 <section class="carousel multicolumn"182 data-columns="@colAmount"183 data-dots="@showDots"184 data-loop="@infiniteLoop"185 data-autoplay="@autoPlay"186 data-controls="@controls"187 data-duration="@duration"188 style="height: @carouselHeight;">189190 @foreach (var column in _data.CarouselItems)191 {192193 bool hasContent = !string.IsNullOrWhiteSpace(column.Button.ButtonText) || !string.IsNullOrWhiteSpace(column.Content.Text) || !string.IsNullOrWhiteSpace(column.Header.HeaderFormatted());194195 string image = column.Image.Image;196 string imagesHeight = _data.ImageHeight == 0 ? "auto" : _data.ImageHeight.ToString() + "px";197 string ImageContainerFixed = hasContent ? "cta-paragraph__image-container--fixed" : "";198 string ImageAsBackground = (column.BackgroundConfiguration.ConfigurationName == "Image as Background") ? "cta-paragraph__image--is-background" : "";199200 string coverImage = "";201202 string figureHeight = !hasContent ? "flex-grow:1" : "height:" + imagesHeight;203 string TempClass = imagesOnlyBool ? "imageOnly" : "hasContent";204 string ImageOnlyImageHeight = imagesOnlyBool ? "height:" + imagesHeight + ";" : "height:auto;";205206 if (!imagesOnlyBool)207 {208 imagesHeight = hasContent ? imagesHeight : imagesHeight = "100%";209 }210211 /*This is work around created by Alla to enable cover mode for stand alone pictures*/212 if (!hasContent && column.Image.BackgroundSize == "bg-cover")213 {214 coverImage = "height:100%;";215 }216217 <div class="carousel-cell-wrap" style="display: flex; min-height:100%; @ImageOnlyImageHeight width: @flexBasis; @coverImage">218219 <section class="cta-paragraph carousel-cell" style="min-height: @imagesHeight; @ImageOnlyImageHeight">220 @{221 string newWindow = column.Button.NewWindow ? "target='_blank'" : "";222223 bool clickableBlock = !string.IsNullOrWhiteSpace(column.Button.ButtonLink) && _data.Clickable;224 string clickableClass = clickableBlock ? "cta-paragraph__container--clickable" : "";225226 double ColumnAmount = colDisplay;227 double ColumnWidthSize = 1/ColumnAmount;228 }229230 @CTAParagraphImage(231 column.Image,232 false,233 null,234 false,235 _data.Fullwidth,236 imagesHeight,237 ColumnWidthSize238 )239 @CTAParagraphContent(240 column.Header,241 null,242 column.Content,243 column.Button,244 column.Image,245 false246 )247248 @if (clickableBlock)249 {250 <a href="@column.Button.ButtonLink" class="cta-paragraph__clickable" @newWindow></a>251 }252 </section>253254 </div>255 }256 </section>257 }258 else if (colDisplay > amountColumns)259 {260 <div>Error: you cant display columns more than you filled in the backend</div>261 }262 }263264 @functions{265 // Check if this carousel contains only images (logo slider)266 bool checkOnlyImages(Carousel _data)267 {268269 int amountColumns = _data.CarouselItems.Count; // Amount of the columns in backend, filled by user270 int emptyColumn = 0;271272 // Loop through all the columns273 foreach (var column in _data.CarouselItems)274 {275 // If button is empty AND content is empty AND header is empty => this is img only276 if (string.IsNullOrWhiteSpace(column.Button.ButtonText) && string.IsNullOrWhiteSpace(column.Content.Text) && string.IsNullOrWhiteSpace(column.Header.HeaderFormatted()))277 {278 emptyColumn++;279 }280 }281282 bool emptyColumnResult = emptyColumn == amountColumns ? true : false;283284 return emptyColumnResult;285286 }287 }288
    Naar boven