How a Request Is Handled

Applies to: Jamroom 7.0+ Last verified: 2026-10-24
  • The router

    Jamroom has no index.php in its main folder. .htaccess sends every request to modules/jrCore/router.php, which:

    1. loads the config, runs every active module's _init(), and starts the session
    2. splits the URL into $_post: module_url, module, option, then _1, _2 ... for the rest. key=value parts become $_post['key'].
    3. finds what handles the URL (below), and runs it
    4. sends the output, then works queue entries in the background (see The Queue System)
  • Who handles a URL

    For yoursite.com/(module url)/(option), the router tries, in order:

    1. the view view_(module)_(option), from views/(option).php or index.php
    2. a magic view registered for that option by any module, such as admin or stream
    3. a skin template (module)_(option).tpl in the active skin
    4. the view view_(module)_default
    5. the template (module)_index.tpl in the skin, or the module's templates/index.tpl, when there's no option
    6. the 404 page

    A URL that isn't a module goes to a skin template of the same name, such as yoursite.com/about to about.tpl, or to a profile when it's a profile's URL. Site Builder pages are handled through events at this point.

  • Events along the way

    The router fires events that modules listen for, such as module_view before a module view, skin_template before a skin template, and index_template for the home page. That's how modules such as Site Builder take over a page without changing the router. See Events and Listeners.

  • The global variables

    Variable What's in it
    $_post The URL parts and form values (from $_REQUEST)
    $_user The user making the request, and their active profile's keys
    $_conf Every setting: (module)_(name)
    $_mods The installed modules and their details

    View functions get $_post, $_user and $_conf as arguments.

Tags