Has anyone used XML with a front controller before?

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
blueyon
Forum Commoner
Posts: 76
Joined: Tue Oct 30, 2007 9:53 am

Has anyone used XML with a front controller before?

Post 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?
User avatar
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?

Post 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.
(#10850)
blueyon
Forum Commoner
Posts: 76
Joined: Tue Oct 30, 2007 9:53 am

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

Post by blueyon »

Arborint

Would you say its a good idea to have a front controller to work like this?
User avatar
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?

Post 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.
(#10850)
Post Reply