I was thinking of setting up a front controller to parse a XML file which contains information such as pre-actions, post-actions and child controllers.
I thnk some people call it mapping.
Example:
<root>
<controller>
<id>product</id>
<url>product/{1-9}</url>
<children>
<child>header</child>
<child>column</child>
<child>footer</child>
</children>
<pre_action>check_login</pre_action>
</controller>
</root>
Has anyone in this forum done this sort of thing before?
If so can you post an example?
Has anyone used XML with a front controller before?
Moderator: General Moderators
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Has anyone used XML with a front controller before?
Yes, but the configuration data format should be independent to its actual use. Create a config object and have the FC use that. Then you are format independent. The Skeleton framework has config classes that are an example of this -- INI, XML, YAMAL, or plain old arrays all end up with the same interface.
(#10850)
Re: Has anyone used XML with a front controller before?
Arborint
Would you say its a good idea to have a front controller to work like this?
Would you say its a good idea to have a front controller to work like this?
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Has anyone used XML with a front controller before?
Not the Front Controller ... that is something for the "router" to handle. The FC should only care what the action is, not the format of the request.
(#10850)