Tuesday, July 15, 2008

Mach-ii sub-application - part 2

To demonstrate sub-application setup I am going to use example application from mach-ii site called ContactManager. If you are going to follow along then download it and unzip into ContactManager folder under your webroot. After that you should be able to browse to it using http://[your-web-root]/contactmanager/

Next I made a folder under contactmanager called "subapp". Under that "config" folder. Also I made a subapphome.cfm file in the "views" folder to show something different in subapp. Just put any random text in that file. Look at an image of the ContactManager tree to see added elements.

Now we separate common elements into an include called mach-ii-common.xml

Those elements are removed from main applications mach-ii.xml, but we add an include before properties section

Here is sub-application mach-ii.xml

Notice the properties for SES URLs.

There is at least one issue with this setup is that links need to be relative to the web root so that they work from main app and from sub app. So in mainTemplate.cfm file I added "/contactmanager/" to all the links resource references at the top.
Here is an example, following lines


As you can see I also added a link to my sub-application.

After all this you should be able to get to your subapp by going to http://[your-web-root]/contactmanager/subapp/index.cfm/event/subapphome/

No comments: