Skip to content

Commit e0b6285

Browse files
refactor: use parsed requestPath instead of splitting URI
1 parent 8d4c407 commit e0b6285

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

html-templates/events/events.tpl

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,14 @@
1414
<h1>{_ "Events"} <span class="badge badge-secondary badge-pill">{$total|number_format}</span></h1>
1515
</header>
1616

17-
{$starUrl = explode('*', $.server.REQUEST_URI)}
18-
{$currentGroup = $starUrl[1]}
19-
2017
<div class="row">
2118
<div class="col-sm-4 col-md-3">
2219
<div class="list-group">
23-
<a class="list-group-item list-group-item-action {tif $currentGroup=='past' ? active}" href="/events/*past">Past Events</a>
24-
<a class="list-group-item list-group-item-action {tif $currentGroup=='upcoming' || $currentGroup=='' ? active}" href="/events/*upcoming">Upcoming Events</a>
25-
<a class="list-group-item list-group-item-action {tif $currentGroup=='all' ? active}" href="/events/*all">All Events</a>
20+
{$requestPath = Site::$requestPath}
21+
{$currentGroup = $requestPath[1]}
22+
<a class="list-group-item list-group-item-action {tif $currentGroup=='*past' ? active}" href="/events/*past">Past Events</a>
23+
<a class="list-group-item list-group-item-action {tif $currentGroup=='*upcoming' || !$currentGroup ? active}" href="/events/*upcoming">Upcoming Events</a>
24+
<a class="list-group-item list-group-item-action {tif $currentGroup=='*all' ? active}" href="/events/*all">All Events</a>
2625
</div>
2726
</div>
2827
<div class="col-sm-8 col-md-9">

0 commit comments

Comments
 (0)