Page 1 of 1

Has anyone used XML with a front controller before?

Posted: Thu Apr 03, 2008 9:47 am
by blueyon
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?

Re: Has anyone used XML with a front controller before?

Posted: Thu Apr 03, 2008 1:40 pm
by Christopher
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.

Re: Has anyone used XML with a front controller before?

Posted: Thu Apr 03, 2008 4:28 pm
by blueyon
Arborint

Would you say its a good idea to have a front controller to work like this?

Re: Has anyone used XML with a front controller before?

Posted: Thu Apr 03, 2008 5:00 pm
by Christopher
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.