I think I do not quite understand what you are aiming for, but I will try, nonetheless:
For each non-static website, whether it is based on Drupal or something else, there are two main things that provide a âcontextâ for deciding what content should be delivered for a given request.
The first and most important is obviously the request itself . This is the only information that is always guaranteed. In most cases, it will just be a GET request, and with that, the URL is implicitly the main source of "context". POST requests may provide a little more âcontextâ besides the URL, but for your question, you could argue that they are just a more sophisticated version of the GET request, providing a few more âargumentsâ other than those specified in the URL (and in most cases, one could request a POST in a GET request with a more complex URL).
The second function of the contextual provision of the session . No matter what kind of processing a session of the mechanism is based on (basically, cookies at present), the goal is always the same: to transfer some âstateâ information across the border of stateless requests by default. This is done by linking a given request to information from previous requests stored on the server side. This allows you to "enrich" the information available to decide what content should be delivered for the request. In principle, one could consider this as a way to add a few more âargumentsâ to the request.
What is it. Any other information needed to build the response must somehow be obtained from the information specified in the request (and we can say that session processing is already the main process for this, adding a âcontextâ based on a cookie or some other identifier with a request).
Drupal reflects this process very well, IMHO, because it first collects the "main" content for the response based on the URL with additional information (for example, about the user) that is "attached" to the session. Only after the main content has been collected through a call to $return = menu_execute_active_handler() in index.php, add other response elements (for example, blocks, menus, etc.), Calling theme('page', $return); .
Thus, regardless of what you want to âtransferâ to these other elements, you need to either âre-extractâ it from the information already used to assemble the main content (URL, session), or you need to temporarily store it during the generation of the main context. You can do this in many ways, for example. adding it to information already stored in the session, using static caching in some functions, setting global variables (not); transferring material through a database, etc.
So, I donât seem to understand what you are aiming for. What are you missing here?