No joy there either. I’m gonna put up the whole thing to see if I’m missing something.
The template I’m working on is my schedule page. I want to see the current schedule here. So if it’s Monday it’ll make the Monday schedule ACTIVE and the others will be FADE. It’s laid out like this:
- Schedule - ID 7
- Monday - ID 25
- Programme 1
- Programme 2
- Programme 3
- Tuesday - ID 27
- Programme 1
- Programme 2
- Programme 3
- Wednesday - ID 29
- Programme 1
- Programme 2
- Programme 3
- Thursday - ID 31
- Programme 1
- Programme 2
- Programme 3
- Friday - ID 33
- Programme 1
- Programme 2
- Programme 3
- Saturday - ID 35
- Programme 1
- Programme 2
- Programme 3
- Sunday - ID 27
- Programme 1
- Programme 2
- Programme 3
This is the code inside the template. It shows 7 snippets for the Navigation Days and 7 snippets for the content.
<div class="col-lg-12 col-md-12 col-sm-12">
<ul class="nav nav-tabs">
[[!schedulePageNavMonday]]
[[!schedulePageNavTuesday]]
[[!schedulePageNavWednesday]]
[[!schedulePageNavThursday]]
[[!schedulePageNavFriday]]
[[!schedulePageNavSaturday]]
[[!schedulePageNavSunday]]
</ul>
</div>
<div class="col-xl-12 col-lg-12 col-md-12">
<div class="tab-content">
[[!schedulePageContentMonday]]
[[!schedulePageContentTuesday]]
[[!schedulePageContentWednesday]]
[[!schedulePageContentThursday]]
[[!schedulePageContentFriday]]
[[!schedulePageContentSaturday]]
[[!schedulePageContentSunday]]
</div>
</div>
The snippet code for schedulePageNavMonday-Sunday is like this. The Monday one for example checks if it’s Monday, if so it adds code and if not adds a different code. The only difference is that it adds a class called ACTIVE and the date if it is the Monday and if not, it won’t add the date and add a class called FADE.
// Create a new DateTime object
$date = new DateTime();
if(date('N') == 1){
echo "<li class=\"nav-item\"> <a class=\"nav-link active\" data-toggle=\"tab\" href=\"#menu1\">" . $date->format("l") . " " . $date->format("d") . " " . $date->format("F") ." ". $date->format("Y") ."</a></li>";
}
else {
// Modify the date it contains
$date->modify('next monday');
echo "<li class=\"nav-item\"> <a class=\"nav-link\" data-toggle=\"tab\" href=\"#menu1\">Monday</a></li>";
}
Then the snippet for the content is similar to the navigation. It adds a class called ACTIVE if current and FADE if not.
$date = new DateTime();
if(date('N') == 1){
$output = '<div id="menu1" class="tab-pane active">';
$output .= '<div class="row">';
$output .= '<div class="col-12 pd1">';
$params = array (
'parents' => 25,
'depth' => 1,
'limit' => 0,
'tpl' => 'scheduleList_GA',
'includeContent' => 1,
'includeTVs' => 1,
'processTVs' => 1,
'showHidden' => 0,
'sortby' => 'menuindex',
'sortdir' => 'ASC',
);
$output .= $modx->runSnippet('getResources', $params);
$output .= "</div>";
$output .= "</div>";
$output .= "</div>";
return $output;
}
else {
// Modify the date it contains
$date->modify('next monday');
$output = '<div id="menu1" class="tab-pane fade">';
$output .= '<div class="row">';
$output .= '<div class="col-12 pd1">';
$params = array (
'parents' => 25,
'depth' => 1,
'limit' => 0,
'tpl' => 'scheduleList_GA',
'includeContent' => 1,
'includeTVs' => 1,
'processTVs' => 1,
'showHidden' => 0,
'sortby' => 'menuindex',
'sortdir' => 'ASC',
);
$output .= $modx->runSnippet('getResources', $params);
$output .= "</div>";
$output .= "</div>";
$output .= "</div>";
}
It picks up on the output DIVS. Just not the getResources part.