Our Forums are now closed. Please go to our Google Mailing List for help. This site will remain open for historical purposes.
ColdBox Framework Forums Home | Profile | Search | Login | RSS

 pdf Print PDF   Previous Page  Page: 1   Next Page

Thread: view/layout strategy
Created on: 03/19/10 09:52 AM Replies: 3
srconklin
Trying not to be a rookie

Joined: 04/02/09
Posts: 16
view/layout strategy
03/19/10 9:52 AM

I am new to Coldbox and have read most of the guides. I am not sure i have fully wrapped my mind around what i can do with views and layouts.
I would like to know what the best practice would be for designing a view/layout directory structure where i can toggle between a complete set of layouts/views without modifying code in the event handlers.

for example, i have the following line in my event handler:

<cfset Event.setView("user/home")

currently the view home.cfm is directly under the views/user directory.

but i would like to create a second version that is contained in a different location (and it is to be rendered with a different layout as well)

i think i would like to be able to set some setting in the config file that would govern how to pull this view from a different location like

views/alternate/user/home.cfm

but NOT have to modify the call to the view in the handler:
<cfset Event.setView("user/home")

at least i think that is what i want.

maybe i should prefix all my my setview calls with a default directory? like so
<cfset Event.setView("#defDir#user/home")
where defDir would be = "alternate" or ""

not sure. I also thought about making use of the prehandler methods or something like that, but i am not sure it gets me what i want.

can you recommend how you would tackle this challenge?
I basically want to just swap out a complete frontend as easily as possible without modifying any code if possible
Link | Top | Bottom
cyberangel67
Veteran Master

Joined: 02/21/09
Posts: 100
RE: view/layout strategy
03/20/10 6:43 PM

So your basically wanting the same event handler to have two different vies/layouts?

This sounds like a skin system to me, and if you like I could post a blog on how I did this in my current system. It's not finished but it is a service that does just that reskins based on what skin you would like to make it.
Link | Top | Bottom
srconklin
Trying not to be a rookie

Joined: 04/02/09
Posts: 16
RE: view/layout strategy
03/20/10 6:55 PM

that sounds like exactly what i am looking for. Please post blog when you can.
Link | Top | Bottom
cyberangel67
Veteran Master

Joined: 02/21/09
Posts: 100
RE: view/layout strategy
03/20/10 7:46 PM

Sure, if you want to contact me at andyscott.id.au I could help you a bit further now. The service is still work in progress, but it works enough to do what you might be looking for.

The downside this will not give you different views for your controller, but it will give you a different look and feel on both the layout and view.

If this is what you are looking for, contact me at the above website.
Link | Top | Bottom

Galleon Forums V1.7.008 was created by Raymond Camden