{sessurl:url}

Description

Builds session-aware and state-aware URLs and form fields. With no argument it returns the current AA session id; with the keyword param it returns the session as a query parameter (AA_Session=SESSIONID), ready to append to a URL; with the keyword hidden it returns a hidden form input carrying the session. These three forms print an empty string when the request has no AA session - on a Site module page that is any visitor without the AA_Session cookie; view.php and slice.php always start a session, so there they print an id even for an anonymous visitor. When they do print a session id, the page is not stored in the page cache, so the id of one visitor is never served to another. Any other value is taken as a URL: when a module is active (for example on an admin page of a slice) and the URL does not already contain module_id=, the command adds module_id=MODULEID as the first query parameter so the next page stays in the same slice; otherwise the URL comes back unchanged. On the public pages of this reference no module is active, so URLs pass through untouched.

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; all three are empty when the request has no AA session. Any other value is treated as a URL and returned with the current module context preserved: module_id=<current module> is added as the first query parameter when a module is active and the URL has none, otherwise the URL is returned unchanged.

Examples

test{sessurl:edit.php?id=42}
Expectededit.php?id=42
Actualedit.php?id=42
With no module active, as on this page, the URL is returned unchanged. On an admin page of a slice the result would be edit.php?module_id=SLICEID&id=42 - the module id is inserted as the first query parameter.
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.
virtual{sessurl}
Expected(the current 32-character session id, for example 0123456789abcdef0123456789abcdef; empty without a session)
The value is the same for the whole session but differs between visitors (and is empty without a session), so this is illustrative rather than a fixed test.
virtual{sessurl:param}
Expected(AA_Session= followed by the session id; empty when there is no session)
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:hidden}
Expected(a hidden input named AA_Session whose value is the session id; empty when there is no session)
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.