-
Notifications
You must be signed in to change notification settings - Fork 0
Docs MVC ViewEngines XSL PageConfiguration
For each route in your application there must be a configuration and a style sheet. This article covers the route configuration. For informations about the style sheet see XML/XSL page style sheets.
Page configuration files should be created in the conf subdirectory of the pages directory. Please make sure that the contents of this path can be read by the webserver user.
One .ini file in the conf directory denotes one route. The name of the file without the .ini extension denote the name of the route that has to be the value of the route argument within the URL in order to see this specific page. (In versions before 1.3.0 the configuration format is XML, hence the files have the .xml extension.)
A route is configured and instantiated with a router instance. It is possible to create your own router and to use a complete other way of configuring the page, e.g. from a database. For this example we will stick with the XML configuration, on the basis of the example provided on our example page.
Stubbles 1.3.0 or greater:
[properties] skin="default" [processables] Test="org::stubbles::examples::processables::TestXMLProcessable" uncached="org::stubbles::examples::processables::CurrentTimeXMLProcessable" counter="org::stubbles::examples::processables::TestProcessableWithInjectedResource"
Versions before Stubbles 1.3.0:
#xml <?xml version="1.0" encoding="iso-8859-1"?> <xj:configuration xmlns:xj="http://xjconf.net/XJConf" xmlns:cfg="http://stubbles.net/util/XJConf" xmlns="http://stubbles.net/websites"> <route> <property name="skin" value="default"/> <processable type="org::stubbles::examples::processables::TestXMLProcessable" name="Test" /> <processable type="org::stubbles::examples::processables::CurrentTimeXMLProcessable" name="uncached" /> <processable type="org::stubbles::examples::processables::TestProcessableWithInjectedResource" name="counter" /> </route> </xj:configuration>
You can see several different sections of the configuration file.
A route may have properties. These are key-value pairs of data that may influence how the page is handled. Currently two properties are directly supported.
Property name | Usage |
---|---|
locale | The general locale can be configured via the config.ini file with the net.stubbles.locale property. However sometimes it may be necessary to mark a certain route as being in a different locale. With this property set one can overwrite the general locale setting. |
skin | The skin property can be used to determine which skin should be used to render the route. If this property is not set the skin named default will be used. (Hence the configuration in this example has the same effect as if the property would not be configured.) More information about the skin can be found on XML/XSL page style sheets. |
forceSSL | This property will force a redirect to the same route, but with https instead of http if the current request was not in SSL mode. |
If necessary, processables can get the route injected and read properties from it.
The other configurations are processables. Processables are the connector between the controlling and the model part of the MVC component in Stubbles. They access the business logic, and perform operations on it influenced by values from the request and the session. This can be used to refer your own processables, which should implement the net::stubbles::websites::processors::routing::stubProcessable interface.
The result of the processing of this page configuration is a XML document which looks something like this:
#xml <?xml version="1.0" encoding="ISO-8859-1"?> <document page="index"> <session> <id>91497fb3ce6cca2656d73b3103733e2d</id> <name>PHPSESSID</name> <isNew>false</isnew> <token> <current>0e5d5519315508fd393a3ca8a7a17a1d</current> <next>943bd92c169b545e52fd27c70cf72650</next> </token> </session> <Test> <foo>Hello World!</foo> </test> <uncached> <currentTime>2007-10-01 20:42:27</currenttime> </uncached> <counter/> <forms> <Test/> <cached/> <uncached/> <counter/> <passThru/> </forms> <request/> </document>