Theres a couple of things that i always end up doing in my modelglue apps,
so i thought i'd chuck them out there and see if anyone thinks theres any
value to them..
Firstly, I always provide my own UrlManager which extends the MG base and
overrides linkTo(). I don't like the fact that the append argument only
accepts a list of vars to pull from the event, so i allow mine to accept a
struct as well. The body of the function ends up looking like this
<!--- Add values --->
<cfif isStruct(arguments.append)>
<cfloop collection="#arguments.append#" item="i">
<cfset link = link & "&#i#=#urlEncodedFormat(arguments.append[i])#" />
</cfloop>
<cfelse>
<cfloop list="#arguments.append#" index="i">
<cfset link = link &
"&#i#=#urlEncodedFormat(arguments.eventContext.getValue(i))#" />
</cfloop>
</cfif>
now i can do
<cfoutput query="myquery">
<cfset append = structnew() />
<cfset append["foo"] = myquery.bar />
<a href="#event.linkTo("some.event", append)#">title</a>
</cfoutput>
and in CF9 this could be even cleaner
<cfoutput query="myquery">
<a href="#event.linkTo("some.event", {"foo"=myquery.bar})#">title</a>
</cfoutput>
The second thing is that I allow event.copyToScope() to return a reference
to the scope, rather than void. I don't think this causes any issues, and
allows me to do this on CF9.
<cfset myStruct = event.copyToScope({"foo"=bar}, "baz,flibble") />
Any value in including these tweaks in the core ?
Cheers, Chris
--~--~---------~--~----~------------~-------~--~----~
Model-Glue Sites:
Home Page: http://www.model-glue.com
Documentation: http://docs.model-glue.com
Bug Tracker: http://bugs.model-glue.com
Blog: http://www.model-glue.com/blog
You received this message because you are subscribed to the Google
Groups "model-glue" group.
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/model-glue?hl=en
-~----------~----~----~----~------~----~------~--~---