I hear you, Will.

Now don't overload my rowboat with motorboat power!  :o)

Rick

> -----Original Message-----
> From: Will Tomlinson [mailto:[EMAIL PROTECTED]
> Sent: Monday, June 23, 2008 10:44 AM
> To: CF-Talk
> Subject: MG is so cool!
> 
> Been playing more with my first model glue app and I realize how awesome it 
> is, just from
tinkering.
> 
> I built a reqUsername method that simply set a randRang() and tacked it onto 
> an email username,
just for
> the fun of it. I hard-coded those values in the randRange().
> 
> Then I thought hm, that's pretty dumb. Why not hard-code them into the event 
> handler and pass them
to
> the controller via some arguments. Worked fine!
> 
> Then thought, hm, this is still pretty dumb. Why not stick those values in my 
> AppConfig in
> coldspring.xml? Worked like a charm. Now, it's totally dynamic and lets you 
> set the values in your
> config.
> 
> Just messin around like this is a great way to learn these frameworks. 
> (AHEMMM RICK!)  :)
> 
> Here's some example code. Maybe it'll help folks just starting with MG.
> 
> Coldspring.xml:
> 
> <bean id="AppConfiguration" class="ModelGlue.Bean.CommonBeans.SimpleConfig">
>     <property name="Config">
>       <map>
>         <entry key="DSN"><value>leroy</value></entry>
>       <entry key="userStartNum"><value>1000</value></entry>
>       <entry key="userEndNum"><value>2000</value></entry>
>       </map>
>     </property>
> </bean>
> 
> Login.cfc:
> 
>    <cffunction name="reqUsername" access="public" returnType="string" 
> output="false">
>      <cfargument name="email" type="any" />
> 
>       <cfscript>
>        var startNum = variables.config.getConfigSetting("userStartNum");
>        var endNum = variables.config.getConfigSetting("userEndNum");
>        var result = "";
>        result = listFirst(arguments.email, "@") & randRange(startNum, endNum);
>       </cfscript>
> 
>         <cfreturn result />
>    </cffunction>
> 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:307958
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to