Nice one Rob.
I do like the custom tag approach. It fits nicely into the MVC methodology - at least for me. I recently encapsulated my custom form renderer (that uses cfUniform) into a custom tag so that I can easily include a form on any of my views simply by broadcasting for my form setup to fire (formName = "xxxx" etc) and then calling in the cf_formRenderer custom tag to render it on the view. Works a treat. Same for when I have stuff like custom box layouts that get reused all over the site. Nice to just call something like: <cf_boxes type="highlight" title="News Feed"> Box content </cf_boxes> James. --- James Allen E: [email protected] Blog: http://jamesallen.name Twitter: @CFJamesAllen (Coldfusion / Web development) Twitter: @jamesallenuk (General) Twitter: @JamesAllenVoice (Voiceover) Tune in to the best in community radio - Codebass Radio: http://codebassradio.net From: [email protected] [mailto:[email protected]] On Behalf Of Robert Rawlins Sent: 26 October 2011 14:51 To: [email protected] Subject: Re: [Model-Glue] Accessing the event context within a helper Hi Dan, James, Thanks for both of your suggestions. I opted for the custom tag route. I decided to compile the link using event.linkTo() outside of the tag and pass it into the tag as an attribute. This way the tag is independent on the framework. I'm really pleased with the result. Thanks to you both. Robert On 26 Oct 2011, at 14:11, Dan Wilson wrote: Just to weigh in here, helpers were intended as a way to share the same copy of a UDF across your application. They are intentionally unaware of ModelGlue. It sounds like you guys have some other options. Personally, when dealing with layout issues, I find Custom Tags to be a little more handy in terms of layout as they do hierarchy and such in a nicer way than UDFs. I can also make a custom tag more declarative than I can make a UDF. It's all personal preference though, because at the end of the day, HTML goes to the browser and Bob is your mother's brother. DW On Wed, Oct 26, 2011 at 8:02 AM, James Allen <[email protected]> wrote: A pleasure mate. It's always good to bounce ideas of people. I'd be interested to hear what route you take. --- James Allen E: [email protected] Blog: http://jamesallen.name <http://jamesallen.name/> Twitter: @CFJamesAllen (Coldfusion / Web development) Twitter: @jamesallenuk (General) Twitter: @JamesAllenVoice (Voiceover) Tune in to the best in community radio - Codebass Radio: http://codebassradio.net <http://codebassradio.net/> From: [email protected] [mailto:[email protected]] On Behalf Of Robert Rawlins Sent: 26 October 2011 13:01 To: [email protected] Subject: Re: [Model-Glue] Accessing the event context within a helper Hi Mate, Yes you might be right there, perhaps I need to decouple it from the framework... back to the drawing board to rethink this. I appreciate the input mate. Thank you. Rob On 26 Oct 2011, at 12:55, James Allen wrote: Good call Rob. Although if the framework injected the event into the helper is that really that much different to you doing it? It's still very MG specific as the helper has to know about the event structure however it gets into it. I think it's the fact that this is for the view layer that it feels slightly odd. May be worth thinking more in terms of framework independence and just passing in what is needed for the method to do it's rendering - then you aren't tied to MG and can use the helper in other frameworks etc. --- James Allen E: [email protected] Blog: http://jamesallen.name <http://jamesallen.name/> Twitter: @CFJamesAllen (Coldfusion / Web development) Twitter: @jamesallenuk (General) Twitter: @JamesAllenVoice (Voiceover) Tune in to the best in community radio - Codebass Radio: http://codebassradio.net <http://codebassradio.net/> From: [email protected] [mailto:[email protected]] On Behalf Of Robert Rawlins Sent: 26 October 2011 12:34 To: [email protected] Subject: Re: [Model-Glue] Accessing the event context within a helper Hi James, You're quite right. I could use a custom_tag for this, I just chose to use a UDF as i'm more familiar with that. I can just pass the event in as an argument to the method, something about that just didn't feel quiet right, I would much rather have access to the event direct within the helpers, perhaps pre-injected by the framework or something. I wasn't sure if something like that was going on under the hood. Thanks bud. Robert On 26 Oct 2011, at 12:27, James Allen wrote: Hi Rob, This nicely follows on from Twitter yesterday. Why not use custom tags instead of helpers here? Then you can just pass in the event structure or individual pieces of data into the custom tag within the relevant views. Although, equally can't you just pass in data to the helper method or the event structure itself? I haven't used helpers myself but they are just UDF's accessed via the event scope right? James. --- James Allen E: [email protected] Blog: http://jamesallen.name <http://jamesallen.name/> Twitter: @CFJamesAllen (Coldfusion / Web development) Twitter: @jamesallenuk (General) Twitter: @JamesAllenVoice (Voiceover) Tune in to the best in community radio - Codebass Radio: http://codebassradio.net <http://codebassradio.net/> From: [email protected] [mailto:[email protected]] On Behalf Of Rawlins Sent: 26 October 2011 12:08 To: [email protected] Subject: [Model-Glue] Accessing the event context within a helper Hello Guys, I'm putting together some helpers which will be generating HTML markup for me. Part of this markup will be creating links. (event.linkTo) I need access to the current event context from within the helper for doing this. Is this possible at all? If not, what's the best way to achieve it? Thanks. Robert -- Model-Glue Sites: Home Page: http://www.model-glue.com <http://www.model-glue.com/> Documentation: http://docs.model-glue.com <http://docs.model-glue.com/> Bug Tracker: http://bugs.model-glue.com <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 -- Model-Glue Sites: Home Page: http://www.model-glue.com <http://www.model-glue.com/> Documentation: http://docs.model-glue.com <http://docs.model-glue.com/> Bug Tracker: http://bugs.model-glue.com <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 -- Model-Glue Sites: Home Page: http://www.model-glue.com <http://www.model-glue.com/> Documentation: http://docs.model-glue.com <http://docs.model-glue.com/> Bug Tracker: http://bugs.model-glue.com <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 -- Model-Glue Sites: Home Page: http://www.model-glue.com <http://www.model-glue.com/> Documentation: http://docs.model-glue.com <http://docs.model-glue.com/> Bug Tracker: http://bugs.model-glue.com <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 -- Model-Glue Sites: Home Page: http://www.model-glue.com <http://www.model-glue.com/> Documentation: http://docs.model-glue.com <http://docs.model-glue.com/> Bug Tracker: http://bugs.model-glue.com <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 -- Model-Glue Sites: Home Page: http://www.model-glue.com <http://www.model-glue.com/> Documentation: http://docs.model-glue.com <http://docs.model-glue.com/> Bug Tracker: http://bugs.model-glue.com <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] <mailto:model-glue%[email protected]> For more options, visit this group at http://groups.google.com/group/model-glue?hl=en -- Plutarch - "The mind is not a vessel to be filled but a fire to be kindled." -- Model-Glue Sites: Home Page: http://www.model-glue.com <http://www.model-glue.com/> Documentation: http://docs.model-glue.com <http://docs.model-glue.com/> Bug Tracker: http://bugs.model-glue.com <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 -- 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 -- 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
