There was a problem with a Velocity script | |
Page | landing/news-template |
Error | Encountered "=" at 1udw3v7qkrztdebylanding/news-template[line 227, column 39] Was expecting one of: <RPAREN> ... "-" ... "+" ... "*" ... "/" ... "%" ... <LOGICAL_AND> ... <LOGICAL_OR> ... <LOGICAL_LT> ... <LOGICAL_LE> ... <LOGICAL_GT> ... <LOGICAL_GE> ... <LOGICAL_EQUALS> ... <LOGICAL_NOT_EQUALS> ... |
Page source: |
1: #set ($ajax = false) 2: #if ($request.getParameter("ajax") == true) 3: #set ($ajax = true) 4: $website.decorate("") 5: #end 6: 7: ## PICK UP OPTIONS 8: $website.includeAgain("options") 9: #set ($options = $request.getAttribute("options")) 10: 11: #set ($dateFormat = "MMMM dd, yyyy") 12: #if ($options.get("site_date_format").length() > 0) #set ($dateFormat = $options.get("site_date_format")) #end 13: 14: #set ($view = "grid") 15: #if ($options.get("news_layout_default_view") == "list") ## default view from options 16: #set ($view = "list") 17: #elseif ($request.getParameter("view") == "list") ## default view from include parameter 18: #set ($view = "list") 19: #end 20: 21: #if ($request.getParameter("view")) 22: #set ($view = $request.getParameter("view")) 23: #end 24: 25: #foreach ($cookie in $request.cookies) ## override default view from user saved cookie if set 26: #if ($cookie.name.equals("news_view") && $cookie.value.equals("list")) 27: #set ($view = "list") 28: #end 29: #end 30: 31: #set ($showTypeFilters = false) 32: #if ($options.get("headlines_filters") == "yes") 33: #set ($showTypeFilters = true) 34: #end 35: #if ($request.getParameter("showTypeFilters") == true) 36: #set ($showTypeFilters = true) 37: #end 38: 39: #set ($reqType = "") 40: #if ($request.getParameter("type")) 41: #set ($paramType = $request.getParameter("type")) 42: #if ($paramType == "preview" || $paramType == "recap") 43: #set ($reqType = $paramType) 44: #end 45: #end 46: 47: #set ($showToggleButtons = true) 48: #if ($options.get("news_layout_show_toggle_buttons") == "no") 49: #set ($showToggleButtons = false) 50: #end 51: #set ($showToggleButtons = $request.getParameter("showToggleButtons")) 52: 53: #set ($showThumb = true) 54: #if ($options.get("news_layout_show_thumb") == "no") 55: #set ($showThumb = false) 56: #end 57: #set ($showThumb = $request.getParameter("showThumb").toString()) 58: #set ($showThumb = $Boolean.parseBoolean($showThumb)) 59: 60: #if (!$showThumb) 61: #set ($view = "list") 62: #set ($showToggleButtons = false) 63: #end 64: 65: #set ($thumbnail-orientation = "ratio ratio-16x9 ratio-adaptive") 66: #if ($options.get("news_thumbnail_orientation") == "portrait") ## default view from options 67: #set ($thumbnail-orientation = "ratio ratio-3x4") 68: #elseif ($options.get("news_thumbnail_orientation") == "landscape") 69: #set ($thumbnail-orientation = "ratio ratio-16x9") 70: #elseif ($options.get("news_thumbnail_orientation") == "adaptive") 71: #set ($thumbnail-orientation = "embed-responsive-adaptive") 72: #elseif ($request.getParameter("thumbnail_orientation") == "portrait") ## default view from include parameter 73: #set ($thumbnail-orientation = "ratio ratio-3x4") 74: #end 75: 76: #set ($showDate = true) 77: #if ($options.get("news_layout_show_date") == "no") 78: #set ($showDate = false) 79: #end 80: #set ($showDate = $request.getParameter("showDate").toString()) 81: #set ($showDate = $Boolean.parseBoolean($showDate)) 82: 83: #set ($showLeadin = true) 84: #if ($options.get("news_layout_show_leadin") == "no") 85: #set ($showLeadin = false) 86: #end 87: #set ($showLeadin = $request.getParameter("showLeadin").toString()) 88: #set ($showLeadin = $Boolean.parseBoolean($showLeadin)) 89: 90: #set ($type = "all") 91: #set ($type = $request.getParameter("type")) 92: 93: ## PAGINGATION SETTINGS 94: #set ($thumbWidth = 767) 95: #set ($pageSize = 48) 96: #set ($showSize = 16) 97: #set ($maxSize = 96) 98: #set ($pageIndex = 0) 99: 100: #set ($pageSize = $tool.math.toInteger($request.getParameter("pageSize"))) 101: #set ($showSize = $tool.math.toInteger($request.getParameter("showSize"))) 102: #set ($maxSize = $tool.math.toInteger($request.getParameter("maxSize"))) 103: #set ($pageIndex = $tool.math.toInteger($request.getParameter("pageIndex"))) 104: 105: #if ($pageSize > $maxSize) 106: #set ($pageSize = $maxSize) 107: #end 108: 109: #if ($showSize > $pageSize) 110: #set ($showSize = $pageSize) 111: #end 112: 113: #set ($allArticles = []) 114: 115: ## THE FOLLOWING CREATES AN ARRAY OF ALL ARTICLES (FILTERED BY TYPE IF REQUESTED) 116: ## THIS LIST IS THEN USED FOR PAGINGATION 117: #foreach ($article in $headlines) 118: #if ($foreach.count <= $maxSize) 119: #if ($reqType.length() > 0) 120: #foreach ($link in $article.inSchedule) 121: #if ($reqType == "recap" && $link.mapType == "RC" && $article.id == $link.id) 122: #set ($bool = $allArticles.add($article)) 123: #elseif ($reqType == "preview" && $link.mapType == "PR" && $article.id == $link.id) ## article is a Preview 124: #set ($bool = $allArticles.add($article)) 125: #end 126: #end 127: #else 128: #set ($bool = $allArticles.add($article)) 129: #end 130: #end 131: #end 132: 133: ## PAGING LOGIC 134: #set ($articlesToRender = []) 135: #set ($pageCount = $tool.math.ceil($tool.math.div($allArticles.size(), $pageSize))) 136: 137: #if ($allArticles.size() > 0) 138: #set ($startIndex = $tool.math.mul($pageIndex, $pageSize)) 139: 140: #set ($endIndex = $tool.math.add($tool.math.mul($pageIndex, $pageSize), $pageSize)) 141: #if ($endIndex > $allArticles.size()) 142: #set ($endIndex = $allArticles.size()) 143: #end 144: 145: #if ($startIndex < $allArticles.size()) 146: #set ($articlesToRender = $allArticles.subList($startIndex, $endIndex)) 147: #end 148: #end 149: 150: #macro(playIcon $article) 151: 152: #if ($article.contentType == "loki/youtube") 153: #set ($videoType = "youtube") 154: #set ($videoSrc = $article.dataAsString) 155: 156: #elseif ($article.contentType == "loki/video") 157: #set ($videoType = "video") 158: #set ($videoSrc = "${article.url}?dec=") 159: #end 160: 161: <button class="btn play-btn bg-transparent text-white fs-1" 162: data-play-video="true" 163: data-video-type="$videoType" 164: data-video-src="$videoSrc" 165: #if ($article.title.length() > 0) data-title="$article.title" #end 166: #if ($article.leadIn.length() > 0 && $showLeadin) data-leadin="$article.leadIn" #end 167: #if ($article.date && $showDate) data-date="$formatter.formatDate($article.date, $dateFormat)" #end 168: > 169: <span class="visually-hidden">Play Video</span> 170: <span class="fab fa-youtube"></span> 171: </button> 172: #end 173: 174: $website.include("sport-labels") 175: #set ($sportLabels = $!request.getAttribute("sportLabels")) 176: 177: ## ARTICLE MACRO 178: #macro (printArticles) 179: <div class="cards" data-module="theme-module/init-video-modal"> 180: #foreach ($article in $articlesToRender) 181: 182: #set ($isVideo = false) 183: 184: ## CATEGORY / TITLE 185: #set ($title = $article.title) 186: 187: #set ($category = "Article") 188: 189: #if($article.contentType == "loki/bio") 190: #set ($category = "Bio") 191: #elseif ($article.contentType == "video/x-flv" || $article.contentType == "loki/video" || $article.contentType == "loki/youtube") 192: #set ($category = "Video") 193: #end 194: 195: #if ($article.url.startsWith("/sports/")) 196: #set ($sportKey = $article.url.split("/").get(2)) 197: #if ($sportLabels.containsKey($sportKey)) 198: #set ($category = $sportLabels.get($sportKey)) 199: #end 200: #else 201: #set ($articleSection = $article.sectionPage) 202: #foreach ($i in [1..5]) 203: #if ($articleSection.url.length() == 0) 204: #break 205: #elseif ($articleSection.sectionPage.url.length() == 0) ## if parent is a root section 206: #if ($articleSection.title.length() > 0) 207: #set ($category = $articleSection.title) 208: #else 209: #set ($firstChar = $articleSection.name.substring(0, 1).toUpperCase()) 210: #set ($afterFirstChars = $articleSection.name.substring(1)) 211: #set ($category = "${firstChar}${afterFirstChars}") 212: #end 213: #break 214: #end 215: #set ($articleSection = $articleSection.sectionPage) 216: #end 217: #end 218: ## END CATEGORY / TITLE 219: 220: #set ($altText = $article.title) 221: 222: #if ($article.thumbnailURL.length() > 0) 223: #set ($thumbnailURL = "${article.thumbnailURL}?max_width=${thumbWidth}") 224: #if ($article.thumbnailPage.altText.length() > 0) 225: #set ($altText = "$article.thumbnailPage.altText") 226: #end 227: #elseif ($article.contentType = "loki/youtube") 228: #set ($thumbnailURL = "https://img.youtube.com/vi/${videoId}/maxresdefault.jpg") 229: #elseif ($website.exists("/images/setup/default-thumbnail.png")) 230: #set ($thumbnailURL = "/images/setup/default-thumbnail.png") 231: #elseif ($website.exists("/images/setup/thumbnail_default.jpg")) 232: #set ($thumbnailURL = "/images/setup/thumbnail_default.jpg") 233: #else 234: #set ($thumbnailURL = "/info/images/default-thumbnail.png") 235: #end 236: 237: #set ($cardClass = "card") 238: #if ($velocityCount > $showSize) 239: #set ($cardClass = "card hidden") 240: #end 241: 242: <div class="${cardClass} border position-relative"> 243: <div class="card-inner position-relative"> 244: #if ($showThumb == true) 245: <div class="thumb overflow-hidden card-img-top ${thumbnail-orientation} bg-black" style="background-image:url('${thumbnailURL}'); background-size:cover; background-position:center;"> 246: <img src="${thumbnailURL}" alt="${altText}" class="img-fluid" /> 247: #if ($isVideo) #playIcon($article) #end 248: </div> 249: #end 250: <div class="card-body border-top rounded-bottom bg-white"> 251: <div class="entry-body-header"> 252: <ul class="entry-meta list-unstyled d-flex align-items-center justify-content-between mb-2 text-muted"> 253: <li class="entry-category">$category</li> 254: <li class="entry-header-date d-none d-lg-block hide-on-grid-view"> 255: <span class="small d-flex align-items-center"> 256: <span class="fa fa-calendar-o"></span> 257: <span class="ms-2">$formatter.formatDate($article.date, $dateFormat)</span> 258: </span> 259: </li> 260: </ul> 261: <div class="card-title entry-title h4 mb-0"> 262: <a class="text-decoration-none clamp-2" href="$article.url">$title</a> 263: </div> 264: #if ($showLeadin == true && $article.leadIn.length() > 0) 265: <p class="card-text entry-summary clamp-3">$article.leadIn</p> 266: #end 267: </div> 268: </div> 269: #if ($showDate == true && $article.date) 270: <div class="card-footer border-top rounded-bottom bg-white text-muted p-3"> 271: <ul class="list-unstyled d-flex align-items-center m-0"> 272: <li class="card-entry-date"> 273: <span class="small d-flex align-items-center"> 274: <span class="fa fa-calendar-o"></span> 275: <span class="ms-2">$formatter.formatDate($article.date, $dateFormat)</span> 276: </span> 277: </li> 278: </ul> 279: </div> 280: #end 281: </div> 282: </div> ## card 283: #end ## loop 284: </div> ## cards 285: #if ($showSize < $articlesToRender.size()) 286: <div class="load-more-container align-center"> 287: <button 288: type="button" 289: class="btn btn-block col-lg-6 btn-primary load-more" 290: aria-label="Load more headlines" 291: data-page-index="$pageIndex" 292: data-page-count="$pageCount">Load more</button> 293: </div> 294: #end 295: #end ## printArticles 296: 297: #macro (printFilters) 298: #if (!$website.isIncluded() || $request.getParameter("showFilters") == true) 299: <div class="container-fluid px-0"> 300: <div class="d-flex justify-content-between flex-column-reverse flex-md-row gap-3 d-print-none"> 301: <div class="btn-toolbar flex-fill justify-content-between d-flex gap-3" role="toolbar" aria-label="news tool bar"> 302: #if ($showTypeFilters) 303: <div class="filter-buttons btn-group btn-group-toggle" data-bs-toggle="buttons"> 304: #set ($btnClass = 'class="btn btn-primary"') 305: #set ($btnActiveClass = 'class="btn btn-primary active" aria-pressed="true"') 306: <button type="button" #if ($type == "all") $btnActiveClass #else $btnClass #end data-type="all">All</button> 307: <button type="button" #if ($type == "preview") $btnActiveClass #else $btnClass #end data-type="preview">Preview</button> 308: <button type="button" #if ($type == "recap") $btnActiveClass #else $btnClass #end data-type="recap">Recap</button> 309: </div> 310: #end 311: 312: #if ($showToggleButtons == true) 313: <div class="view-switch btn-group btn-group-toggle"> 314: <button class="btn btn-primary #if($view == "list") active #end" data-view="list"> 315: <span class="fa-regular fa-list" aria-hidden="true"></span> 316: <span class="sr-only">List View</span> 317: </button> 318: <button class="btn btn-primary #if($view == "grid") active #end" data-view="grid"> 319: <span class="fa-regular fa-th-large" aria-hidden="true"></span> 320: <span class="sr-only">Grid View</span> 321: </button> 322: </div> 323: #end 324: </div> 325: 326: ## SEASON SELECTION 327: $website.includeAgain("${page.url}?tmpl=season-dropdown-template") 328: </div> 329: </div> 330: #end 331: #end ## printFilters 332: 333: #macro (printLayout) 334: <div class="page-content news-content news-layout ${view}" data-module="theme-module/news-layout" data-page-url="$page.url" data-page-size="$pageSize" data-show-size="$showSize" data-max-size="$maxSize"> 335: 336: #set ($headingTag = "h1") 337: #if ($request.getParameter("headingTag")) 338: #set ($headingTag = $request.getParameter("headingTag")) 339: #end 340: 341: #set ($pageTitle = "Headlines") 342: #if ($page.title.length() > 0) 343: #set ($pageTitle = $page.title) 344: #end 345: #if (!$website.isIncluded()) 346: $!request.setAttribute("pageTitle", "${pageTitle}") 347: #end 348: 349: <div class="layout-inner d-flex flex-column gap-3"> 350: <${headingTag} class="mb-0">$pageTitle</${headingTag}> 351: 352: #if ($articlesToRender.size() > 0) 353: #printFilters() 354: #printArticles() 355: #else 356: <div class="alert alert-primary">Nothing to show.</div> 357: #end 358: </div> 359: </div> ## page-content 360: 361: ## GLOBAL ADS SERVER 362: #if ($website.ads.isAdvertisingEnabled('NEWS') && !$website.isIncluded()) 363: $website.includeAgain("global-adserver-slots?adSlot=news") 364: #end 365: #end ## printLayout 366: 367: #if ($ajax) 368: <div class="ajax-response">#printArticles</div> 369: #else 370: #printLayout 371: $wiki 372: #end |