[This section is under construction!] DictatorDictator is the simplest, yet most important module of the Alt Framework. As the controller of all requests, Dictator is in charge of gluing everything together. By providing a standard URI based context system, Dictator makes it easy to create logical hierarchies using folder-like structures. Dictator provides a standard environment for each request execution with immediate access to the SQueaL, Onion ML, and Dictator modules. It provides means to define index pages, child pages, and 404 pages using a simple set of directives. Unlike the SQueaL and Onion ML modules, Dictator does not use XML to define control structures. The reasoning is because based on user authentication, the programmer should be able easily define what child pages are available from a single point. Quick TutorialAlt creates a global Dictator object in the request scope with the name Dictator parses the URI and splits it up based on forward-slash characters. Let us add the dictator.map({ '': 'mysite.Index', 'users': 'mysite.Users', 'forums': 'mysite.forums.Index, 'google': dictator.Redirect('http://google.com/'), 'api': 'alt.jsdoc.html.Main', 'debug': 'alt.debug.Main' }); This tells Dictator to look at the "next" piece of the URI and map it to a particular script. For example, here, assuming Alt was running on port 4500 and mapped to /* on example.com, going to http://example.com/ would load the srcipt Dictator has a built in index listing based on calls to map, so going to http://example.com/ would simply list the |
|
page last updated: Sunday, February 17, 2008 |