Well something isn't right on my end. Here's my XML: <properties> <property name="testContentId" value="468" /> </properties>
<event-handler event="display.test" access="public"> <event-arg name="intContentId" variable="${testContentId}" /> <notify listener name="cms" method="getContent" resultArg="strContent" /> </event-handler> And the exception I get when I hit the event's URL: Parameter 1 of function IsDefined, which is now ${testContentId}, must be a syntactically valid variable name. Tag Context: C:\webdev\workspace\dr09.cfcomponents.trunk\MachII\1.8.0.alpha \framework\commands\EventArgCommand.cfc (115) C:\webdev\workspace\dr09.cfcomponents.trunk\MachII\1.8.0.alpha \framework\commands\EventArgCommand.cfc (72) C:\webdev\workspace\dr09.cfcomponents.trunk\MachII\1.8.0.alpha \framework\EventHandler.cfc (62) C:\webdev\workspace\dr09.cfcomponents.trunk\MachII\1.8.0.alpha \framework\RequestHandler.cfc (339) C:\webdev\workspace\dr09.cfcomponents.trunk\MachII\1.8.0.alpha \framework\RequestHandler.cfc (287) C:\webdev\workspace\dr09.cfcomponents.trunk\MachII\1.8.0.alpha \framework\RequestHandler.cfc (228) C:\webdev\workspace\dr09.cfcomponents.trunk\MachII\1.8.0.alpha \framework\RequestHandler.cfc (158) C:\webdev\workspace\dr09.cfcomponents.trunk\MachII\1.8.0.alpha\mach- ii.cfc (159) C:\webdev\workspace\dr09.cfcomponents.trunk\MachII\1.8.0.alpha\mach- ii.cfc (81) Am I doing something wrong or is this a bug? On May 19, 3:30 pm, "Peter J. Farrell" <pe...@mach-ii.com> wrote: > Phil Harvey said the following on 05/19/2009 01:20 PM:> Ok, two more > questions: > > > #1: How can I set a property that I want available in all contexts > > (development, staging, production, etc.) and applied to all servers? I > > know I can use * in the servers attribute, but what about the > > environments? This would be equivalent to the <common> section in > > Martin's plugin. > > Just define normal properties. If they are not environment specific, > then it's just a normal property. Also, the environment property will > override any properties set in the XML so you can set a default in a > property and optionally override it. > > > #2: Can I reference a property in the Mach-II XML. For example, we > > have a Content Management System here that uses a number to lookup a > > page in the CMS. So we have a pattern like this occurring everywhere, > > using appConstants that was embedded in the Request scope by the > > appConstants plugin: > > > <event-handler event="display.home" access="private"> > > <event-arg name="intContentId" > > variable="Request.appConstants.CMSIDs.moduleName.home" /> > > <notify listener="cms" method="getContent" resultArg="strcontent" / > > > <execute subroutine="masterLayout" /> > > </event-handler> > > > After setting the appropriate value using the EnvironmentProperties, I > > tried something like the following but it doesn't work, and I think I > > remember reading somewhere that you can't embed ${} property > > references in event commands. > > > <event-arg name="intContentId" variable="${CMSIDs.moduleName.home}" /> > > Yes, you can -- you've probably read that we were in the midst of > upgrading some command attributes to support the expression evaluation > syntax. > > With 1.8, you can do this: > > <event-arg name="intContentId" variable="${property.nameOfProperty}" /> > > Kind of important to not name your property names with "dots" - "." in them. > > Or... > > <event-arg name="intContentId" variable="${event.eventArgName}" /> > > > Is there another way to reference properties directly in the Mach-II > > for code like this? The reason we do this in this particular case is > > our CMS Ids are different for development/staging than production in > > many cases, unfortunately. We have thousands of items in the CMS and > > this is the way we solved it for the time being between development > > and production. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to Mach-II for CFML list. To post to this group, send email to mach-ii-for-coldfusion@googlegroups.com To unsubscribe from this group, send email to mach-ii-for-coldfusion-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/mach-ii-for-coldfusion?hl=en SVN: http://greatbiztoolsllc.svn.cvsdude.com/mach-ii/ Wiki / Documentation / Tickets: http://greatbiztoolsllc.trac.cvsdude.com/mach-ii/ -~----------~----~----~----~------~----~------~--~---