VBScript errors on Function defs mixed with executable code in same block. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>pull/5/head
| @@ -13,20 +13,24 @@ If IsObject(CurrentController) Then | |||||
| End If | End If | ||||
| On Error GoTo 0 | On Error GoTo 0 | ||||
| End If | End If | ||||
| If Len(pageTitle) = 0 Then pageTitle = "BrainOrdure" | If Len(pageTitle) = 0 Then pageTitle = "BrainOrdure" | ||||
| Dim currentPath | |||||
| currentPath = LCase(Request.ServerVariables("HTTP_X_ORIGINAL_URL")) | |||||
| If InStr(currentPath, "?") > 0 Then currentPath = Left(currentPath, InStr(currentPath, "?") - 1) | |||||
| Dim hdr_path | |||||
| hdr_path = LCase(Request.ServerVariables("HTTP_X_ORIGINAL_URL")) | |||||
| If InStr(hdr_path, "?") > 0 Then hdr_path = Left(hdr_path, InStr(hdr_path, "?") - 1) | |||||
| Function NavClass(ByVal prefix) | |||||
| If Left(currentPath, Len(prefix)) = prefix Then | |||||
| NavClass = "nav-link active" | |||||
| Else | |||||
| NavClass = "nav-link" | |||||
| End If | |||||
| End Function | |||||
| Dim hdr_navHome, hdr_navPosts, hdr_navCats | |||||
| hdr_navHome = "nav-link" | |||||
| hdr_navPosts = "nav-link" | |||||
| hdr_navCats = "nav-link" | |||||
| If hdr_path = "/" Or hdr_path = "" Or Left(hdr_path, 5) = "/home" Then | |||||
| hdr_navHome = "nav-link active" | |||||
| ElseIf Left(hdr_path, 6) = "/posts" Then | |||||
| hdr_navPosts = "nav-link active" | |||||
| ElseIf Left(hdr_path, 11) = "/categories" Then | |||||
| hdr_navCats = "nav-link active" | |||||
| End If | |||||
| %> | %> | ||||
| <html lang="en"> | <html lang="en"> | ||||
| <head> | <head> | ||||
| @@ -52,13 +56,13 @@ End Function | |||||
| <div class="collapse navbar-collapse" id="mainNav"> | <div class="collapse navbar-collapse" id="mainNav"> | ||||
| <ul class="navbar-nav ms-auto mb-2 mb-lg-0"> | <ul class="navbar-nav ms-auto mb-2 mb-lg-0"> | ||||
| <li class="nav-item"> | <li class="nav-item"> | ||||
| <a class="<%= NavClass("/") %>" href="/">Home</a> | |||||
| <a class="<%= hdr_navHome %>" href="/">Home</a> | |||||
| </li> | </li> | ||||
| <li class="nav-item"> | <li class="nav-item"> | ||||
| <a class="<%= NavClass("/posts") %>" href="/posts">Posts</a> | |||||
| <a class="<%= hdr_navPosts %>" href="/posts">Posts</a> | |||||
| </li> | </li> | ||||
| <li class="nav-item"> | <li class="nav-item"> | ||||
| <a class="<%= NavClass("/categories") %>" href="/categories">Categories</a> | |||||
| <a class="<%= hdr_navCats %>" href="/categories">Categories</a> | |||||
| </li> | </li> | ||||
| </ul> | </ul> | ||||
| </div> | </div> | ||||
Powered by TurnKey Linux.