Error executing template "Designs/SSTemplate/_parsed/news.parsed.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_27968366425640a5bb784dd3944da9e3.Execute() in E:\dynamicweb.net\Solutions\Sendistovan\j2019.dw9.dynamicweb-cms.com\files\Templates\Designs\SSTemplate\_parsed\news.parsed.cshtml:line 198
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @using System.Web.Mvc; 2 @using System.Text.RegularExpressions; 3 @using System.Web; 4 @using System.IO; 5 @using System.Linq; 6 @{ 7 string basecss = "/Files/Templates/Designs/SSTemplate/css/base.css"; 8 string ifolder = basecss.Substring(0, basecss.LastIndexOf("/")).ToString(); 9 string ifolderOnDisk = System.Web.HttpContext.Current.Server.MapPath(ifolder); 10 DirectoryInfo idirectoryInfo = new System.IO.DirectoryInfo(ifolderOnDisk); 11 string idatefetch=@idirectoryInfo+"\\base.css"; 12 DateTime ilastmodified = File.GetLastWriteTime(@idatefetch); 13 basecss=@basecss+"?modified="+@ilastmodified.ToString("yyyy-MM-ddTHH:mm:ss"); 14 string stylecss = "/Files/Templates/Designs/SSTemplate/css/styles.css"; 15 string ufolder = stylecss.Substring(0, stylecss.LastIndexOf("/")).ToString(); 16 string ufolderOnDisk = System.Web.HttpContext.Current.Server.MapPath(ufolder); 17 DirectoryInfo udirectoryInfo = new System.IO.DirectoryInfo(ufolderOnDisk); 18 string udatefetch=@udirectoryInfo+"\\styles.css"; 19 string logo=@GetString("Item.Area.Design.Logo"); 20 DateTime ulastmodified = File.GetLastWriteTime(@udatefetch); 21 stylecss=@stylecss+"?modified="+@ulastmodified.ToString("yyyy-MM-ddTHH:mm:ss"); 22 }@{ 23 24 string kolofonimg=@GetString("Item.Area.Design.Ikon"); 25 }<!DOCTYPE html> 26 <html lang="fo"> 27 @{ 28 string pageid=@GetString("DwPageID"); 29 string readspeak=@GetString("Item.Area.Funktionalitetir.BaseUr")+"?id="+pageid; 30 string pagenametit=@GetString("DwPageName"); 31 32 string pagearea=@GetString("DwPageID_1"); 33 pagearea="top"+pagearea; 34 ViewBag.BaseUrl = @GetString("Item.Area.Funktionalitetir.BaseUr"); 35 ViewBag.StoddStarvs = @GetString("Item.Page.StoddStarv"); 36 }<head> 37 <meta charset="utf-8"> 38 <meta http-equiv="X-UA-Compatible" content="IE=edge"> 39 <meta name="viewport" content="width=device-width, initial-scale=1"> 40 41 <meta name="author" content=""> 42 <meta property="og:url" content="@readspeak"> 43 <meta property="og:locale" content="fo_FO"> 44 <meta property="og:title" content="@pagenametit"> 45 <meta name="google-site-verification" content="_8UkOXR321xXc60VV1folaRbl3pukMQpv1ifNUwjZXU"> 46 <link rel="shortcut icon" type="image/ico" href="/Files/Templates/Designs/SSTemplate/img/favicon.ico"> 47 <link rel="shortcut icon" type="image/png" href="/Files/Templates/Designs/SSTemplate/img/favicon.png"> 48 @RenderSnippet("FBimg") 49 50 @foreach(LoopItem i in GetLoop("Item.Area.Design.Fontar")){ 51 52 @i.GetString("Item.Area.Design.Fontar.Font") 53 54 } 55 <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css"> 56 <link rel="stylesheet" href="/Files/Templates/Designs/SSTemplate/css/meanmenu.css?build=25"> 57 <link rel="stylesheet" href="@basecss"> 58 59 <link rel="stylesheet" href="@stylecss"> 60 61 62 <link type="text/css" rel="stylesheet" href="/Files/Templates/Designs/SSTemplate/css/base-mobil.css"> 63 <link type="text/css" rel="stylesheet" href="/Files/Templates/Designs/SSTemplate/css/styles-mobil.css"> 64 <script type="text/javascript" src="/Files/Templates/Designs/SSTemplate/Fontur/Javascript/Clan.js"></script> 65 @GetValue("CopyRightNotice") 66 @GetValue("MetaTags") 67 @GetValue("Stylesheets") 68 @GetValue("Javascripts") 69 </head> 70 <body> 71 72 <script src="https://consent.cookiefirst.com/banner.js" data-cookiefirst-key="17b974b4-88db-494d-b44a-84321fcda66f"></script> 73 74 @GetString("Item.Area.SomeAndShare.FacebookJaascriptSDK") 75 76 77 <div class="mynav d-md-none d-lg-none d-xl-none"> 78 @GetValue("DwNavigation(mobmen)") 79 80 </div><!-- #dl-menu end --> 81 82 <div class="TopTopMenu container-fluid d-none d-sm-none d-md-block"> 83 <div class="row"> 84 <div class="container"> 85 <div class="row"> 86 <div class="col-12 toptopred"> 87 <div class="samband"> 88 <a href="/"><img class="logoimg" src="@logo" alt="Javnaðarflokkurin"></a> 89 </div> 90 <div class="toptoplinks navigation"> 91 <a class="toptopfacebooklink" target="_blank" href="https://www.facebook.com/Javnadarflokkurin1925/"><span class="icon-share-facebook"><span class="path1"></span><span class="path2"></span><span class="path3"></span></span></a> 92 @GetValue("DwNavigation(topnavul)") 93 94 95 </div> 96 <div class="langswapper"> 97 </div> 98 <div class="cart"> 99 </div> 100 </div> 101 </div> 102 </div> 103 </div> 104 </div> 105 106 107 <div class="container d-none d-sm-none d-md-block"> 108 <div class="row"> 109 <div class="col-12" id="topmenu"> 110 111 @GetValue("DwNavigation(topmen1)") 112 113 <form method="get" action="?id=47" id="searchform" class="form-inline my-2 my-md-0 relative searchform"> 114 <input type="hidden" name="id" value="47"> 115 <input type="submit" class="hide"> 116 117 @{string placeholder=@GetString("Item.Area.NavAndSearch.PlaceholderTekstur");} 118 <input class="form-control stdsrchinput" name="q" type="text" placeholder="@placeholder"><span class="icon-search searchicon "></span> 119 120 </form> 121 </div> 122 </div> 123 </div><!--- NAVIGATION ---> 124 125 126 @if(@GetString("Item.SystemName")=="Frontpage"){ 127 <div class="container-fluid bottomheadborder"></div> 128 } 129 130 131 @if(GetBoolean("Item.ShowBradcrumbs") == true || @GetString("Item.SystemName")=="Greinaskrivari") 132 {<text> 133 <div class="container-fluid mb-0 bread"> 134 <div class="container"> 135 <div class="row"> 136 <div class="bread col my-3"> 137 @GetValue("DwNavigation(bread)") 138 </div> 139 </div> 140 </div> 141 </div> 142 </text> 143 } 144 <!--- BREADCRUMB ---> 145 146 @using System.Text.RegularExpressions; 147 @using System.Web; 148 @using Dynamicweb.Content; 149 150 @{ 151 string mynd=@GetString("Item.Area.Design.FacebookDeilFallback"); 152 153 string play=""; 154 string videostart=""; 155 156 int sidaid=0; 157 } 158 159 @if(!string.IsNullOrEmpty(@GetString("Item.Video"))){play="<span class='icon-media-video'></span>"; videostart="videostart";} 160 else {play="";} 161 162 @if(!String.IsNullOrEmpty(GetString("Item.Mynd"))){ 163 mynd = @GetString("Item.Mynd"); 164 mynd=@mynd.Replace(" ", "%20"); 165 } 166 167 168 @SnippetStart("FBimg") 169 <meta property="og:image" content="@ViewBag.BaseUrl@mynd"> 170 @SnippetEnd("FBimg") 171 172 173 174 175 176 <div class="container newsintro-parent relative"> 177 178 @{ 179 string writer=""; 180 string writerimg=""; 181 string imgcroppoint=""; 182 183 184 } 185 186 @if (!GetBoolean("Item.GuestWriterONOFF")){ 187 <text> 188 189 190 191 192 @if(!String.IsNullOrEmpty(@GetString("Item.GreinaskrivariDropdown"))){ 193 <text> 194 @{ 195 string writeridstring=@GetString("Item.GreinaskrivariDropdown"); 196 int writerid=Int32.Parse(@writeridstring); 197 var item = Dynamicweb.Content.Items.ItemManager.Storage.GetById("Greinaskrivari", @writeridstring); 198 writer = item["Navn"].ToString(); 199 writerimg=item["Mynd"].ToString().Replace("?x", "&x"); 200 var writerpage=Dynamicweb.Services.Pages.GetPageForItem("Greinaskrivari", @writeridstring); 201 sidaid = Dynamicweb.Services.Pages.GetPageForItem("Greinaskrivari", @writeridstring).ID; 202 203 204 205 } 206 </text> 207 } 208 209 </text> 210 } 211 else { 212 writer=@GetString("Item.GuestWriter"); 213 writerimg=@GetString("Item.GuestWriterImafge"); 214 imgcroppoint=@GetString("Item.GuestWriterImafge.FocalPointParameters"); 215 216 } 217 218 219 @if(!String.IsNullOrEmpty(@GetString("Item.Mynd"))){ 220 mynd=@GetString("Item.Mynd"); 221 } 222 223 @if(String.IsNullOrEmpty(@mynd)){ 224 225 mynd="/Files/Templates/Designs/SSTemplate/img/fallback-umbod.jpg"; 226 } 227 228 @if(sidaid!=0){ 229 <a class="authorcont hide-mobile" href="/default.aspx?id=@sidaid"> 230 @if(!String.IsNullOrEmpty(@writerimg)){ 231 <div class="autorimage"><img src="/Admin/Public/Getimage.ashx?image=@writerimg&width=140&height=140&Crop=7&@imgcroppoint"> </div> 232 } 233 234 <div class="authorname">@writer </div> 235 236 </a> 237 } 238 else{ 239 <div class="authorcont"> 240 @if(!String.IsNullOrEmpty(@writerimg)){ 241 <div class="autorimage"><img src="/Admin/Public/Getimage.ashx?image=@writerimg&width=140&height=140&Crop=7&@imgcroppoint"> </div> 242 } 243 244 <div class="authorname">@writer </div> 245 246 </div> 247 } 248 249 250 251 252 <div class="row"> 253 <div class="col-xl-9 col-12 col-md-10 mt-5 newsintro"> 254 @if(!String.IsNullOrEmpty(GetString("Item.NewsType"))){ 255 <text><span class="greintype">@GetString("Item.NewsType").Replace("Tidindi", "Tíðindi").Replace("Lesarabraev", "Lesarabræv")</span></text>}<span class="dato">@GetDate("Item.Dato").ToString("dd. MMMM yyyy")</span> 256 @if(!String.IsNullOrEmpty(@writer)){ 257 <div class="authorname author-mobile">@writer </div> } 258 259 <h1>@GetString("Item.Yvirskrift") </h1> 260 261 262 263 @if(!String.IsNullOrEmpty(GetString("Item.Inngangstekstur"))){ 264 <p class="introIII mt-4 mb-5">@GetString("Item.Inngangstekstur")</p> } 265 </div> 266 </div> 267 </div> 268 269 <div class="container newsshare-parent"> 270 <div class="row"> 271 @if(@GetBoolean("Item.MogulleikaFyriAtDeila")==true){ 272 <text> 273 <div class="col-xl-1 col-md-0 share-parent"> 274 275 276 277 <div class="linja mt-5"></div> 278 <p class="share">Deil:</p> 279 <a href="#" onclick="window.open('https://www.facebook.com/sharer/sharer.php?u='+encodeURIComponent(location.href),'facebook-share-dialog','width=626,height=436');return false;"><span class="icon-share-facebook"><span class="path1"></span><span class="path2"></span><span class="path3"></span></span></a> 280 @{ 281 string pagename=@GetString("DwPageName"); 282 string pagelink=@HttpContext.Current.Request.Url.AbsoluteUri; 283 } 284 <a href="mailto:?Subject=@pagename&body=Trýst á leinki her @pagelink"><span class="icon-share-email"><span class="path1"></span><span class="path2"></span><span class="path3"></span></span></a> 285 286 287 </div> 288 </text> 289 } 290 <div class="col-12 col-xl-9 col-md-10 newsmynd-parent"> 291 @if(!String.IsNullOrEmpty(@GetString("Item.Mynd"))){ 292 <text> 293 294 295 <div class="newsitemimage relative @videostart"> 296 @{ 297 int focalx=@GetInteger("Item.Mynd.FocalX"); 298 int focaly=@GetInteger("Item.Mynd.FocalY"); 299 } 300 <img src="/Admin/Public/Getimage.ashx?image=@mynd&width=900&height=500&Crop=7&x=@focalx&y=@focaly" class="img-fluid mt-5 mb-5"> 301 @play 302 303 @if(!String.IsNullOrEmpty(@GetString("Item.Evni"))){ 304 <span class="newsevni">@GetString("Item.Evni")</span> 305 } 306 307 </div> 308 </text> 309 } 310 311 </div> 312 313 <div class="col-12 col-xl-2 col-md-2 newsmyndatekstur"> 314 @if(!String.IsNullOrEmpty(GetString("Item.Myndatekstur"))){ 315 <div class="linja mt-5 ml-2"></div> 316 317 <text> 318 <p class="myndatekstur ml-2">@GetString("Item.Myndatekstur")</p> 319 </text>} 320 </div> 321 </div> 322 </div> 323 324 325 <div class="container newscont"> 326 <div class="row"> 327 <div class="col-12 col-xl-7 offset-xl-2 col-sm-12 offset-sm-0 newstekstur"> 328 @GetString("Item.Tekstur") 329 </div> 330 </div> 331 </div> 332 333 @if(!String.IsNullOrEmpty(@GetString("Item.TeksturKnap")) && !String.IsNullOrEmpty(@GetString("Item.LeinkiKnappur"))){ 334 <text> 335 <div class="container newsknaplink-parent"> 336 <div class="row"> 337 <div class="col-12 offset-sm-2 "> 338 <h2 class="alternative newsknaplink offset-sm-2">@GetString("Item.YvirskriftTilKnapp")</h2> 339 </div> 340 <a href='@GetString("Item.LeinkiKnappur")' class="col-12 col-xl-7 offset-xl-2 col-sm-12 offset-sm-0 oydublad my-3"> 341 @GetString("Item.TeksturKnap") <span class="icon-download taknidur"></span> 342 </a> 343 </div> 344 </div> 345 346 </text> 347 } 348 @if (!String.IsNullOrEmpty(GetString("Item.YvirskrftMyndasavn"))) 349 { 350 <div class="container newsgallery-parent"> 351 <div class="row"> 352 <h2 class="offset-sm-2 alternative">@GetString("Item.YvirskrftMyndasavn")</h2> 353 <div class="card-columns offset-md-1 col-md-9 col-12" id="lightgallery"> 354 @* Ensure GetLoop isn't null before attempting to iterate *@ 355 @{ 356 var files = GetLoop("Item.Mappa.ListOfFiles"); 357 if (files != null) 358 { 359 foreach (var file in files) 360 { 361 // Safely access file and its values 362 var filePath = GetValue("Item.Mappa") + "/" + file?.GetValue("Item.Mappa.FileName"); 363 if (!String.IsNullOrEmpty(filePath)) 364 { 365 <div class="card mb-4"> 366 <a class="item" href="@filePath"> 367 <img class="card-img" src='/admin/public/getimage.ashx?&Image=@filePath&Resolution=75&Compression=90&Width=200&Crop=0'> 368 </a> 369 </div> 370 } 371 } 372 } 373 } 374 </div> 375 <div class="col-md-2 col-12"> 376 <div class="linja ml-2"></div> 377 @* Check if TeksturTilMyndasavn exists *@ 378 @if (!String.IsNullOrEmpty(GetString("Item.TeksturTilMyndasavn"))) 379 { 380 <p class="myndatekstur ml-2">@GetString("Item.TeksturTilMyndasavn")</p> 381 } 382 </div> 383 </div> 384 </div> 385 } 386 387 388 <div class="container mb-5 hide"> 389 <div class="row"> 390 <div class="col-12 next"> 391 <div class="text-right"> 392 <a href="#"><p>Næst</p> <span class="icon-arrow-right"></span></a> 393 </div> 394 </div> 395 </div> 396 </div> 397 398 399 400 <div class="container-fluid bg-grey othernews-parent"> 401 <div class="container pb-5 othernews-heiti-parent"> 402 <div class="row othernews"> 403 404 <div class="col-12 m-4 othernews-heiti"> 405 <h2 class="text-center">Nýggjastu tíðindi og greinar</h2></div> 406 @RenderParagraphContent(3) 407 408 </div> 409 </div> 410 </div> 411 412 413 <div class="container"> 414 <div class="col-12 text-center"> 415 <a class="scrolltop"> <span class="icon-backtotop"><span class="path1"></span><span class="path2"></span></span></a> 416 </div> 417 </div> 418 419 420 421 @if (!string.IsNullOrWhiteSpace(@GetString("Item.Video"))) { 422 <text> 423 <script> 424 document.addEventListener("DOMContentLoaded", function(event) { 425 $('.videostart').on('click', function() { 426 $(this).lightGallery({ 427 dynamic: true, 428 zoom: false, 429 youtubePlayerParams: { modestbranding: 1, showinfo: 0, controls: 0, rel: 0 }, 430 dynamicEl: [{ 431 "src": '@GetValue("Item.Video")' 432 }] 433 }) 434 435 }); 436 }); 437 438 439 </script> 440 441 </text>} 442 443 444 445 <div class="container-fluid footer"> 446 <div class="container"> 447 <div class="row "> 448 449 <div class="col-xl-3 col-md-12 col-12 mt-5"> 450 @RenderParagraphContent(27) 451 </div> 452 <div class="col-xl-3 col-md-4 col-12 mt-5"> 453 @RenderParagraphContent(28) 454 </div> 455 <div class="col-xl-3 col-md-4 col-12 mt-5"> 456 @RenderParagraphContent(29) 457 </div> 458 <div class="col-xl-3 col-md-4 col-12 mt-5 fourth"> 459 @RenderParagraphContent(30) 460 </div> 461 </div> 462 </div> 463 </div> 464 465 <div class="container-fluid footerbottom"> 466 <div class="container"> 467 <div class="row"> 468 <div class="col-12 text-center"> 469 <a class="kolofon" target="_blank" href="//www.sendistovan.fo"><img src="@kolofonimg" alt="Sendistovan">Ein loysn frá Sendistovuni</a> 470 </div> 471 </div> 472 </div> 473 </div> 474 475 476 <div class="mob-search"> 477 <form method="post" action="?id=47" id="mob-searchform"> 478 <input type="submit" class="hide"> 479 <input class="mobinput" name="q" type="text" placeholder="Leita"><span class="icon-search mob-searchicon mob-submit"></span> 480 <span class="icon-menu-close mob-search-close"></span> 481 482 </form> 483 </div> 484 485 486 <div class="mobilmenpush hide"> 487 488 @GetValue("DwNavigation(mobtoptopnav)") 489 490 491 </div> 492 493 494 <link type="text/css" rel="stylesheet" href="/Files/Templates/Designs/SSTemplate/lightgallery/css/lightgallery.min.css"> 495 <link rel="stylesheet" href="/Files/Templates/Designs/SSTemplate/css/tablesaw.css"> 496 <script src="/Files/Templates/Designs/SSTemplate/js/tablesaw.js"></script> 497 <script src="/Files/Templates/Designs/SSTemplate/js/tablesaw-init.js"></script> 498 <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> 499 <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"></script> 500 <script src="/Files/Templates/Designs/SSTemplate/lightgallery/js/lightgallery.min.js"></script> 501 <script src="/Files/Templates/Designs/SSTemplate/lightgallery/js/lg-thumbnail.js"></script> 502 <script src="/Files/Templates/Designs/SSTemplate/lightgallery/js/lg-zoom.js"></script> 503 <script src="/Files/Templates/Designs/SSTemplate/lightgallery/js/lg-video.js"></script> 504 <script src="/Files/Templates/Designs/SSTemplate/js/sendistovan.js"></script> 505 506 507 508 <script src="/Files/Templates/Designs/SSTemplate/js/meanmenu.js?build=24"></script> 509 <script> 510 document.addEventListener("DOMContentLoaded", function(event){ 511 jQuery('.mynav').meanmenu(); 512 513 514 var div1Html = $('.mobilmenpush').html(); 515 516 $( ".meanmenu" ).append(div1Html); 517 518 $(".search-reveal").click(function(){ 519 520 521 $('.mob-search').fadeIn("fast"); 522 $('.mobinput').focus(); 523 }); 524 525 $(".mob-submit").click(function(){ 526 $('#mob-searchform').submit(); 527 }); 528 529 530 }); 531 532 </script> 533 534 <script> 535 window.addEventListener('resize', function(event){ 536 jQuery('.mynav').meanmenu(); 537 538 539 var div1Html = $('.mobilmenpush').html(); 540 541 $( ".meanmenu" ).append(div1Html); 542 543 $(".search-reveal").click(function(){ 544 545 546 $('.mob-search').fadeIn("fast"); 547 $('.mobinput').focus(); 548 }); 549 </script> 550 551 <script> 552 553 document.addEventListener("DOMContentLoaded", function(event){ 554 $('.mob-search').hide(); 555 556 $(".mob-search-close").click(function(){ 557 558 559 $('.mob-search').fadeOut("fast"); 560 }); 561 562 563 564 }); 565 </script> 566 567 568 569 570 571 @{ 572 string valevniid=@GetString("Item.Id"); 573 574 } 575 576 577 578 579 <script type="text/javascript"> 580 document.addEventListener("DOMContentLoaded", function(event){ 581 jQuery(".minunikkarow").load("/Default.aspx?ID=379&wid=@valevniid"); 582 }); 583 </script> 584 585 586 587 588 <script> 589 document.addEventListener("DOMContentLoaded", function(event){ 590 if(document.getElementById("cookiwarcont") !== null) 591 { 592 $('#cookiwarcont').load('/Default.aspx?ID=30'); 593 } 594 }); 595 </script> 596 597 @GetString("Item.Area.Funktionalitetir.FacebookTrackingPixul") 598 599 @if(!String.IsNullOrEmpty(@GetString("Item.Area.Funktionalitetir.TrackingID"))) { 600 <text> 601 @{ 602 string trackid=@GetString("Item.Area.Funktionalitetir.TrackingID");} 603 @GetString("Item.Area.Uppseting.GoogleMapApi") 604 <script async="" src="https://www.googletagmanager.com/gtag/js?id=@trackid"></script> 605 <script> 606 window.dataLayer = window.dataLayer || []; 607 function gtag(){dataLayer.push(arguments);} 608 gtag('js', new Date()); 609 610 gtag('config', '@GetString("Item.Area.Funktionalitetir.TrackingID")'); 611 </script> 612 </text> 613 } 614 615 616 617 </body> 618 </html> 619 620