Good question :) I was trying to save and retrieve content blocks from
database based on event and view, and use it as display arguments in the
view.

But now, I don't need the view name any more. I decided to do it by just
event name. Still, I think it might be good to have a method to retrieve the
view name (I don't have a use case any more though).

Also, thanks to Joel for pointing to xPath. Here is what I ended up doing.

I will have an xml file with the definition of all the event-args that will
come from the database.

<event-args>
<!-- Global, available on all events -->
<event-arg name="pageTitle" value="" >
 <event name="*" />
</event-arg>
<!-- Event Specific -->
 <event-arg name="confirmationText" value="" >
<event name="user.list" />
 </event-arg>
<!-- Generic, available only though getDBEventArg() -->
 <event-arg name="someText" value="" />
<!-- Two - in - one -->
 <event-arg name="sometext" value="" >
<event name="*" />
 <event name="user.list" />
</event-arg>
</event-args>

Now I will use a pre-event plugin point to retrieve the data and inject
event-arg in to the event. xPath makes the search very easy:

<cfset eventName = event.getName() />
<cffile action="read" file="#ExpandPath('../config/dbEventArg.xml')#"
variable="dbEventXML" />
<cfset dbEventXML = xmlParse(dbEventXML) />
<cfset eventArgNodes =
xmlSearch(dbEventXML,"event-args/event-arg[event[(@name='*')or(@name='#eventName#')]]/@name/")
/>

Comments are welcome...


On Thu, Jan 7, 2010 at 10:43 PM, Peter J. Farrell <[email protected]> wrote:

>  What exactly are you trying to accomplish?
>
> Sumit Verma said the following on 07/01/10 08:07:
>
> By parsing config XML? Hmm... Not sure how I feel about that. I was hoping
> framework had some method to get it.
>
> On Thu, Jan 7, 2010 at 8:42 AM, jlcox <[email protected]> wrote:
>
>> XPath?
>>
>>
>> --
>> You received this message because you are subscribed to Mach-II for CFML
>> list.
>> To post to this group, send email to
>> [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]
>> 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/
>>
>
>
>
> --
> You received this message because you are subscribed to Mach-II for CFML
> list.
> To post to this group, send email to
> [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> 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/
>
-- 
You received this message because you are subscribed to Mach-II for CFML list.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
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/

Reply via email to