{sessurl:url}

Description

Builds session-aware and state-aware URLs and form fields. With no argument it returns the current session id. With the keyword param it returns the session parameter ready to append to a query string (AA_Session=); with the keyword hidden it returns a ready-made hidden form input carrying the session. Given any other value, it treats that value as a URL and returns it with the current module context preserved (it appends module_id= when a module is active and the URL does not already carry one), otherwise the URL is returned unchanged. Session-related output (the bare id, param and hidden modes) is runtime-dependent and differs on every request.

Parameters

url optional default (empty string)

Optional. With no value, the bare session id is returned. The special keywords param and hidden return the session as a query parameter (AA_Session=<sessid>) or as a hidden form input. Any other value is treated as a URL and returned with the current module context preserved: module_id=<current module> is appended when a module is active and the URL has none, otherwise the URL is returned unchanged.

Examples

virtual{sessurl}
Expected(the current 32-character session id, for example 7ffa91acaed1625ad32769ef62935b52)
Actualabc2e4c759bdc61a472c8c8b0cd016fd
With no argument, sessurl returns the current session id (a 32-character hex string). The value is different on every request, so this is illustrative rather than a fixed test.
virtual{sessurl:hidden}
Expected()
)">Actual
The keyword hidden returns a ready-made hidden form input carrying the session, for placing inside a form. Output is HTML and runtime-dependent, so illustrative.
virtual{sessurl:param}
Expected(AA_Session=)
ActualAA_Session=abc2e4c759bdc61a472c8c8b0cd016fd
The keyword param returns the session ready to append to a query string. The session name on this install is AA_Session. Runtime-dependent, so illustrative.
virtual{sessurl:edit.php?id=42}
Expected(edit.php?id=42, with &module_id= appended when a module is active)
Actualedit.php?id=42
Given a plain URL with no module_id, sessurl appends module_id=<current module> when a module is active, so the link keeps the user in the same slice. Where no module is active (as on this page) the URL is returned unchanged. Context-dependent, so illustrative.
test{sessurl:view.php?vid=12&module_id=NEWS}
Expectedview.php?vid=12&module_id=NEWS
Actualview.php?vid=12&module_id=NEWS
When the URL already carries module_id (or no module is active), sessurl returns it untouched. This is the deterministic, context-independent case.