Skip to content

Commit

Permalink
Default Header if None Provided
Browse files Browse the repository at this point in the history
Sets default header to UChicago Arts if none is provided
  • Loading branch information
athuler committed Feb 13, 2024
1 parent 51e218c commit cc44004
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function getPageData($file) {
$matches = getPageData($file);

// Get header image
$pattern = '~<img alt="" src="/(.*?)"/>~s';
$pattern = '~<img alt="" src="/(.*?)"~s';
preg_match_all($pattern, $file, $header_matches);
if(sizeof($header_matches[1]) != 0) {
$header_src = $header_matches[1][0];
Expand Down Expand Up @@ -147,7 +147,7 @@ function gtag(){dataLayer.push(arguments);}

<!-- Displaying a Show -->
<?php if($displaying_show) { ?>
<img src="https://tickets.uchicago.edu/<?=$header_src;?>" class="img-fluid rounded mx-auto d-block" alt="" id="headerImg" style="">
<img src="https://tickets.uchicago.edu/" class="img-fluid rounded mx-auto d-block" alt="" id="headerImg" style="">
<br/>
<div class="row">
<!-- Back to home -->
Expand Down Expand Up @@ -210,7 +210,12 @@ function gtag(){dataLayer.push(arguments);}
console.debug(jsObject);

// Set Header Image
//document.getElementById("headerImg").src = "https://tickets.uchicago.edu"+jsObject["searchResults"][0][20];
var headerImgUrl = "<?=$header_src;?>";
if(headerImgUrl != "") {
document.getElementById("headerImg").src = "https://tickets.uchicago.edu/"+headerImgUrl;
} else {
document.getElementById("headerImg").src = "https://tickets.uchicago.edu/content/Images/UC%20Arts%20Images/UChicagoArts_Horizontal_GreyMaroonRGB.png";
}

// Set Template Element
template = document.getElementById("performanceTemplate");
Expand Down Expand Up @@ -384,7 +389,11 @@ function gtag(){dataLayer.push(arguments);}
}

// Set Performance Thumbnail
thisPerformance.querySelector('.card-img-top').src = "https://tickets.uchicago.edu/"+show[20];
if(show[20] != "") {
thisPerformance.querySelector('.card-img-top').src = "https://tickets.uchicago.edu/"+show[20];
} else {
thisPerformance.querySelector('.card-img-top').src = "https://tickets.uchicago.edu/content/Images/UC%20Arts%20Images/UChicagoArts_Horizontal_GreyMaroonRGB.png";
}

// Set Performance Link
thisPerformance.querySelector('a').href = show[0];
Expand Down

0 comments on commit cc44004

Please sign in to comment.