Here comes the short version of the Big Picture...
- an URL comes in and gets splitted into pieces /[language]/[page id or link]/[request]/[id], with default values for all parts.
- a Page lookup is done, either through id or pagelink + language, defaults resp "welcome" and "[defaultlanguage]", example "en".
- a Context is created to contain all info about the current request
- a Page has an Item and Item has Template
- the Template specifies the Controller which is now created and initialized
- the Controller is asked if he wants users to be logged-in before accessing this Page, if so, the current request will be remembered and the user will be sent to the login page: /[language]/login , which restarts the process we're describing here.
- the Template defines the controllers contructor that will receive a "doRequest" method. In here the controller can use models or whatever logic to prepare the Context for being rendered.
- a Template also has a default View, but the doRequest of the Controller called can return a different (name of the) view
- This view will be asked to render the html (or other) content, it gets all it's data from the Context (which is made the global scope at rendering time).
Example:
http://www.cody-cms.org/en/shortstory language = en, pagelink = shortstory -> page, item and template are found -> standard ContentController is made, setup and sent "doRequest", no login needed. -> the view "content.ejs" is asked to render the context.