Hi cbUsers!
For a new project, I started using Coldbox (v. 6.6.1) intensively. I have a few questions to ask:
#1
Oops! Seems ColdBox is still not ready to serve requests, please try again.
Using a suggest (or press F5 F5 F5…), I noticed that - every now and then - Coldbox returns this error. I don’t restart Coldbox on every request, but my environment is “development”.
I guess it depends on this.
#2
post( "/login/do" )
.toHandler( "AuthController.doLogin" );
get( "/login" )
.toHandler( "AuthController.login" );
In Router, I have to write the entries in this order.
Because looking for “/login/do” in the url, the “/login” event fires before “/login/do”.
Is that correct or am I doing something wrong?
#3
I tried to render an external view in a controller, but if I write like this (with extension):
renderExternalView("/apps/utils/404.cfm")
but i get this error:
ROOT\apps\utils\404.cfm.cfm] not found
without extension I get:
ROOT\apps\manager\views[method-not-found].cfm not found
the file with the same name as the method in the url is loaded.
Can’t I use renderExternalView() in a controller, but only in the view?
I’m trying to use this method in my param “invalidEventHandler” function.
#4
I found that I can write:
event.setView( "firstDir/secondDir/myFile" );
Is it a bug or a features? (I have never found any such example)
This allows me to organize my code much better.
#5
this code:
event.setView( view="main/login", layout="login" )
gets this error:
ROOT\apps\manager\views\AuthController\login.cfm] not found
… same for (chaining + inline):
event.setView( view="main/login" ).setLayout( "login" );
It works if i use chaining:
event.setView( "main/login" ).setLayout( "login" );
Same for:
event.setView( view="main/login", noLayout=true );
ROOT\apps\manager\views\AuthController\login.cfm] not found
I must write:
event.setView( "main/login" ).noLayout();
Likewise I can’t use any other event arguments (like args, cache …)
I guess I’m doing something wrong …
#6
I can’t use “relocate()”
For any value (url, uri or event) i get this error:
relocate( uri="/manager/dashboard" ); <-- my phisical url
relocate( "/dashboard" );
relocate( event="MainController.dashboard" );
(I attach stacktrace error.htm.pdf (241.9 KB) )
this is entry in my Router:
get( "/dashboard" )
.to( "MainController.dashboard" ).end();
#7
Finally, a piece of advice.
In this project have got a “public” part and a “admin” part.
The UIs are completely different. They use the same services.
I made two Coldbox applications, like this:
/apps
/admin
/config/Coldbox.cfc
/controllers
/views
/apps
/public
/config/Coldbox.cfc
/controllers
/views
It seems to work well, but do you think it is a good choice?
Or I may need to load view of the other app or share the UserController between the two applications.
The only problem I see in unifying the apps is the folder that contains the controllers.
While for the views I can write (using only one “views” directory):
setView ('public/shipment/new')
or
setView ('admin/shipment/list')
… how can i organize my controllers well?
Should I write this?
AdminShipmentController.cfc
and
PublicShipmentController.cfc
too long …
Some advice?
.
.
Sorry for the long post. Thanks if you want to answer me.
Apart from these small problems, I’m using Coldbox intensively for the first time. I’m finding very well!
Thank you guys!