Coldbox Basic Concepts

Hi

I have a good knowledge of coldfusion but i am new to coldbox.

Currently i have been working on Converting our legacy app to coldbox one by one page.

I have setup the coldbox 4.3 because we have coldfusion 10 on our server.

As i am new to coldbox i have few question in mind if any one can help would be great.

In our old application we used to work with including files.

1.login required (check if user is logged in and incldues query of member statics if logged in.)
2.Settings (Sets various paths such as download path, images path, server path, etc based on which server code is running.)
3. Some pages we have directly called stored procedure using cfstoredprocedure

I want to know which is the best way to work with above points.

Right now i have create a model for login required and settings which return data to controller. Which i can pass to view.

Is there any other option to manage the include files code and pass to view. ?

Thanks in Advance.

You may use renderView() or runEvent().

See these pages:

1.login required (check if user is logged in and incldues query of member statics if logged in.)

Move this code into a service and put the check into a preProcess interceptor.

function preProcess() {
if( !AuthenticationService.isLoggedIn() ) {
setNextEvent( ‘main.login’ );
}
]

2.Settings (Sets various paths such as download path, images path, server path, etc based on which server code is running.)

Place these setting in your /config/ColdBox.cfc in the “settings” struct and access them in your views/layouts/handlers/interceptors as

getSetting( ‘mySetting’ );

Or inject them into your models as:

property name=‘mySetting’ inject=‘coldbox:setting:mySetting’;

  1. Some pages we have directly called stored procedure using cfstoredprocedure

Not sure what you’re asking here. Just use the cfstoredproc tag?? I would recommend putting all your DB calls into a DAO or service model, injecting it where you need it, and calling a method to get back the results.