calling service / model for layout or view

118 views
Skip to first unread message

AJ Mercer

unread,
Mar 16, 2010, 10:13:17 PM3/16/10
to framew...@googlegroups.com
What are people doing to get data into common parts of a layout or view?

For example,
    pull navigation out of a database
    every page in the site has a list of categories (not just the categories section)

  • make a call in App.cfc setupRequest()
  • added to every section controller and call in before()
  • let the layout/view call the service directly
  • Other?


--

AJ Mercer
http://webonix.net
http://twitter.com/webonix

Nando

unread,
Mar 17, 2010, 9:49:39 AM3/17/10
to framew...@googlegroups.com
What about an abstract controller with a before() method? I just tried a quick test and it works, but I'm not sure what folks might think about the approach from an architectural standpoint.


--
You received this message because you are subscribed to the Google Groups "framework-one" group.
To post to this group, send email to framew...@googlegroups.com.
To unsubscribe from this group, send email to framework-on...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/framework-one?hl=en.



--
Nando M. Breiter
The CarbonZero Project
CP 234
6934 Bioggio
Switzerland

+41 91 606 6372

na...@carbonzero.ch
www.carbonzero.ch

Jamie Krug

unread,
Mar 17, 2010, 9:50:19 AM3/17/10
to framew...@googlegroups.com
Anything required for every (or nearly every) single request seems destined for Application.cfc:setupRequest(). Controller before() methods would work too, but could get repetitive (a base controller CFC might be an option).

Though the doController() method will be deprecated, I think this makes the most sense for the time being:

function setupRequest()
{
var navigationController = getController( 'navigation' );
doController( navigationController, 'getNavigation' );
}

Also keep in mind that Sean recently said the following (http://groups.google.com/group/framework-one/browse_thread/thread/82013dc9389ecbbd/fab5ba738fec2ef2?hl=en#5d3e89420b9a9fc1):

I plan to provide a better way to do controller calls inside Application.cfc as well at which point the wiki and examples will be updated and doController() will be officially deprecated ("frowned upon very strongly")...

Best,
Jamie

--

Sean Corfield

unread,
Mar 17, 2010, 11:20:19 PM3/17/10
to framew...@googlegroups.com
FWIW, what I'm leaning toward is:

controller( 'navigation.getNavigation' );

which will queue up the controller call to happen at the start of the
controller sequence in the main request processing part of the system,
as a mirror to how service( 'foo.bar' ) works.

Not wedded to that, just my current preference.

Once I'm out from under my current deadlines, I'll draw up an official
roadmap for 1.1 and solicit feedback on how things should change. That
will include pretty much everything hinted at in the reference manual
with the 'd' word as well as a review of any / all open tickets.

Sean

AJ Mercer

unread,
Mar 17, 2010, 11:31:16 PM3/17/10
to framew...@googlegroups.com
beside the way it doController() called - pass sting rather than controller object, would there be anything else that would differ?

I am thinking that if doController() is used now
can it easily be swapped out for controller() without affecting the application?
That is, the end result is still the same - rc loaded with data



--
You received this message because you are subscribed to the Google Groups "framework-one" group.
To post to this group, send email to framew...@googlegroups.com.
To unsubscribe from this group, send email to framework-on...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/framework-one?hl=en.

Sean Corfield

unread,
Mar 18, 2010, 4:23:59 PM3/18/10
to framew...@googlegroups.com
On Wed, Mar 17, 2010 at 8:31 PM, AJ Mercer <ajme...@gmail.com> wrote:
> beside the way it doController() called - pass sting rather than controller
> object, would there be anything else that would differ?

doController() is a direct call to the method on the controller at that point.

controller() would queue up the call - like service() is a deferred call.

It would be more in keeping with the principles of the framework.

Calls to controller() would queue up controller methods to be called
just before the 'before()' lifecycle point (and thus you could only
use it in setupApplication(), setupSession() and setupRequest() -
after those points, it would be 'too late', just like you can't call
service() in itemEnd() methods or later.
--
Sean A Corfield -- (904) 302-SEAN
Railo Technologies US -- http://getrailo.com/
An Architect's View -- http://corfield.org/

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood

Reply all
Reply to author
Forward
0 new messages