Consolidated ASP Classic MVC framework from best components
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

47 rindas
1.7KB

  1. <%
  2. ' Classic ASP splices #include files together as raw text before compiling,
  3. ' and Option Explicit is only legal once, as the literal first statement of
  4. ' the resulting page. Default.asp pulls in the entire application (core/*,
  5. ' app/controllers/*, app/views/*) via autoload_core.asp below, so this single
  6. ' declaration enforces explicit variable declaration across all of it. Do not
  7. ' add another Option Explicit to any included file - see AGENTS.md.
  8. Option Explicit
  9. %>
  10. <!--#include file="..\core\autoload_core.asp" -->
  11. <%
  12. ' Define starter application routes
  13. router.AddRoute "GET", "/home", "HomeController", "Index"
  14. router.AddRoute "GET", "/", "HomeController", "Index"
  15. router.AddRoute "GET", "", "HomeController", "Index"
  16. router.AddRoute "GET", "/404", "ErrorController", "NotFound"
  17. ' Resolve the route/controller/action. MVC is a Windows Script Component
  18. ' and (per AGENTS.md's "Controllers Coordinate; They Do Not Render") never
  19. ' writes HTML itself - Resolve()/ExecuteAction() only ever report success
  20. ' or populate LastError, and rendering happens here. It also cannot use
  21. ' Server-Side Includes, so the layout wrapping that used to happen inside
  22. ' Dispatch() now happens here, guarded by MVC.UseLayout.
  23. Dim requestResolved
  24. requestResolved = MVC.Resolve(Request.ServerVariables("REQUEST_METHOD"), _
  25. TrimQueryParams(Request.ServerVariables("HTTP_X_ORIGINAL_URL")))
  26. If Not requestResolved Then
  27. RenderMvcError MVC.LastError
  28. Else
  29. If MVC.UseLayout Then
  30. %><!--#include file="../app/views/Shared/Header.asp" --><%
  31. End If
  32. MVC.ExecuteAction()
  33. If Not (MVC.LastError Is Nothing) Then
  34. RenderMvcError MVC.LastError
  35. End If
  36. If MVC.UseLayout Then
  37. %><!--#include file="../app/views/Shared/Footer.asp" --><%
  38. End If
  39. End If
  40. %>

Powered by TurnKey Linux.