Module Properties

3 views
Skip to first unread message

sli...@gmail.com

unread,
Jul 1, 2008, 11:56:00 AM7/1/08
to Mach-II for ColdFusion
Hi all.

I am trying to output a property in my view that has been set in an
included module. How does this work?

Basically, the idea is that our cms application runs multiple
websites. I figured we would have a base mach-ii xml file that would
handle all the default events, parameters etc... We would then have a
module defined for each site that our application handles. These would
be able to set site specific parameters, events, etc. I read the
documentation on modules, but It doesn't really mention anything about
outputing module specific parameters. Also, I haven't yet worked out
how to tell the application which module to use.

Is this a good use case for modules or will it be better to find
another way of doing this?

Kurt Wiersma

unread,
Jul 1, 2008, 5:32:26 PM7/1/08
to mach-ii-for...@googlegroups.com
It sounds like you might be better off using an include in this case. Modules are designed to be used when you have a sub application you want to run inside a larger application. In your case it sounds like you have a separate application for each website.

--Kurt

sli...@gmail.com

unread,
Jul 1, 2008, 5:45:33 PM7/1/08
to Mach-II for ColdFusion
Well the idea is to use the same CMS for multiple sites. I was hoping
modules would allow me to essentially extend the base config allowing
me to set site specific properties, override event-handlers, etc...
assuming I would be able to tell the application which site it was
(which config to look at).

I see that modules don't quite work this way.

Is there a way to programmaticlly load an include during runtime?

On Jul 1, 4:32 pm, "Kurt Wiersma" <kwier...@gmail.com> wrote:
> It sounds like you might be better off using an include in this case.
> Modules are designed to be used when you have a sub application you want to
> run inside a larger application. In your case it sounds like you have a
> separate application for each website.
>
> --Kurt
>
> On Tue, Jul 1, 2008 at 10:56 AM, bpick...@forumcomm.com <slim...@gmail.com>

Peter J. Farrell

unread,
Jul 1, 2008, 6:21:05 PM7/1/08
to mach-ii-for...@googlegroups.com
bpic...@forumcomm.com said the following on 7/1/2008 4:45 PM:

> Well the idea is to use the same CMS for multiple sites. I was hoping
> modules would allow me to essentially extend the base config allowing
> me to set site specific properties, override event-handlers, etc...
> assuming I would be able to tell the application which site it was
> (which config to look at).
>
> I see that modules don't quite work this way.
>
No, modules are sub-applications that inherit from the base application

> Is there a way to programmaticlly load an include during runtime?
>
The easiest way is to include your base stuff as an include and define
your concrete application using overrides:

mach-ii.xml:
<mach-ii>
<includes>
<include file="./mach-ii_base.xml"/>
<include file="./mach-ii_myApp.xml"/ override="true">
</includes>
</mach-ii>

You would put all that default stuff in mach-ii_base.xml and then define
your application in mach-ii_myApp.xml. The base mach-ii.xml is just for
pulling things together. By using the override attribute, its saying to
Mach-II to override any namespace conflicts that have already been
loaded. So if mach-ii_base.xml has an event-handler named home, you can
have an event-handler named home in mach-II_myApp.xml that will override
the event handler in the base.xml. This is because includes are loaded
in the order they are defined, but applied after the file they are
defined in is parsed -- this is why you don't define anything in
mach-ii.xml.

HTH,
Peter

sli...@gmail.com

unread,
Jul 2, 2008, 10:27:40 AM7/2/08
to Mach-II for ColdFusion
Well, the thing is that I will have more than one mach-ii_myapp.xml
file to load in. So it would be more like this.

<mach-ii>
<includes>
<include file="./mach-ii_base.xml"/>
<include file="./mach-ii_myApp1.xml"/ override="true">
<include file="./mach-ii_myApp2.xml"/ override="true">
<include file="./mach-ii_myApp3.xml"/ override="true">
<include file="./mach-ii_myApp4.xml"/ override="true">
<include file="./mach-ii_myApp5.xml"/ override="true">
<include file="./mach-ii_myApp6.xml"/ override="true">
</includes>
</mach-ii>

Each of these could/will have:
1) A 'siteLogo' property the value being the path to the site's logo
2) Other site specific properties (probably all with the same name)
3) Possibly another hompage event that defines a different layout of
page elements/widgets
4) Other duplicated events for defining a different layout

When I tried your suggestion, the last include overrode everything
else. But, I believe that I've come up with a different solution. If I
prefix all the properties/methods/etc, in the site config files with
their site names, that should allow me to create a plugin that can
decide which properties and methods to use. Not what I originally had
in mind, but I think it should work.

On Jul 1, 5:21 pm, "Peter J. Farrell" <pe...@mach-ii.com> wrote:
> bpick...@forumcomm.com said the following on 7/1/2008 4:45 PM:> Well the idea is to use the same CMS for multiple sites. I was hoping
Reply all
Reply to author
Forward
0 new messages