Rendering Content With Elements

Request Context - or - How did we get here?

So you've got yourself some URLs, and your Section is linked to the Element that's going to handle your page-render. Great!

The routing engine's main job is to populate information about the request through to the render layer. This is called the Request Context and is accessible to your code inside of your element's xpr.request object.   

Now, as a developer you have complete control over what gets rendered, and how. We're just going to send you a message; you can use every piece of it, or happily ignore the whole thing.   

So far, we've touched on Sections and Articles. Let's explore what the xpr.request object might look like in a real world scenario:  

mydomain.com/home/about-us/contact?Parameter=HelloWorld

Variable Description
Domain data for mydomain.com domain
Section data for about-us section
Article data for contact article
urlParams contains the dict {Parameter: 'HelloWorld'}

There's a lot more in that object. Our objects are browsable, in the Bundle Editor, so you'll be able to get up to speed on the available data in no time. 

A quick note on routing to elements: Although not technically part of the sitemap, Elements themselves are routable directly by the global /elementAjax/ route. Elements live inside of Bundles, and are referenced by a string called a bundlePath which follows the format {bundle}/{path}.   

Putting it all together, if you have an Element ShoppingCart inside of a Store Bundle it is routable directly by the url mydomain.com/elementAjax/Store/ShoppingCart