If you are looking for different applications to run under the same framework. Then there is nothing that you need to do, just write the application as you normally would.
Modules are for sharing code that can plug into your application and could potentially be taken and plugged in some other site. That doesnt mean you cant use modules either, in fact i would encourage it.
/core
/coldbox
/handlers - available to all
/model - available to all
/views - available to all
/site1
/config - site specific
/handlers - site specific
/site2
/config - site specific
/views - site specific
Notice that there is only one coldbox dir, but multiple config dirs.
The "magic" happens from your coldbox mappings and pointing your web
server to site1, site2, etc. Core is not a working site, it is just
the holder for everything that gets extended by the sub sites. If you
want a handler to act differently in one subsite, rewrite it and only
that site uses that handler.
I have tried this but this happens only at application load.
if one client wants to see an application in his browser. 2nd client
wants a different application in his browser
and
The application structure to be like this...
/site1 + site 2 in same framework skeleton
/config - site specific
-----------Coldbox1.cfc for site 1
-----------Coldbox2.cfc for site 2
/handlers
-----------Handler1.cfc for site 1
-----------Handler2.cfc for site 2
/model
-----------Model1 folder for site 1
-----------Model2 folder for site 2
/views
-----------View1 folder for site 1
-----------View 2 folder for site 2
When you change the property COLDBOX_CONFIG_FILE and load Coldbox2.cfc
to load config settings of site2 it overrides the previously loaded
Coldbox1.cfc of site1. So if client1 is seeing site1 in his browser
and when client2 requests for site2 it overrides site1 and if client1
refreshes his browser page he will be seeing site2
Jeetu, I believe that is why you need to use the folder structure I
described above, so that you have separate application scopes.
I realize that you are simplifying the description, but i have to
ask: If *all* of this stuff is separated (handlers, model, views) why
are you trying to combine them? Why not just create two separate
sites? Is there code that overlaps? Can you explain the functional
requirements a little more?
Yes the 3 applications are having 3 different appNames
coldbox = {
appName = "[Product News | Investor News | Sports News]",
...
}
But only one Application.cfc Corresponding to 'News'
The 3 applications work independently except some models are shared.
Each application needs to be mapped as a URL with a separate
defaultEvent and other config file parameters.
This is why i proposed the 3 config objects instead of config files so
that every setting can be reused for different applications inside the
same framework skeleton and wont be overridden. The 3 config objects
stay in the same Application Scope as3 different entities used by 3
different applications
Instead of <cfset COLDBOX_CONFIG_FILE = ""> if we have <cfset
COLDBOX_CONFIG_OBJS = "Coldbox1, Coldbox2, Coldbox3">
where Coldbox1, Coldbox2 and Coldbox3 are instances of component
Coldbox.cfc
and we are able to load config settings of Application1 from Coldbox1
and same for 2 & 3.
Is Config object instance possible instead of config file?
Yes the 3 applications are having 3 different appNames
coldbox = {
appName = "[Product News |
Investor News | Sports News]",
...
}
But only one Application.cfc Corresponding to 'News'
The 3 applications work independently except some models are shared.
Each application needs to be mapped as a URL with a separate defaultEvent
and other config file parameters.
This is why i proposed the 3 config objects instead of config files so
What i am thinking is to instantiate 3 object instances of config
(Coldbox.cfc) ie, coldbox1, coldbox2 & coldbox3 in the single
Application.cfc (Application Scope) and use the 3 instances to load
their default controllers based on the URL.
All i want to do is to get 3 config objects in the single application
scope to control my 3 sub applications (Product News, Investor News
and Sport News) in the News Application framework skeleton. These
three are different business in the single framework.
News -- is the coldbox framework -- contains Application.cfc
(this.name = "News")
---Product News -- is Application 1 initiates from url /index.cfm?
event=Handler1.Init (coldbox1 appName="Product News")
---Investor News -- is Application 2 initiates from url /index.cfm?
event=Handler2.Init (coldbox2 appName="Investor News")
---Sports News -- is Application 3 initiates from url /index.cfm?
event=Handler3.Init (coldbox3 appName="Sports News")
Let me ask this then, why is it important to have 3 configs? The only thing
that I can see that will be different is settings for each app, the others
like caching, conventions etc should be the same.
If you can give me a clue as to why or what you want to achieve from the
config's Ill show maybe a better way to approach it.
Give you an example, I have 5 sites running from one application, with one
config file and multiple ORM's and Event handlers.
With what you are suggesting is it possible to see "Sports News" and
"Product News" simultaneously in 2 browsers?
When you load "Sports News" from your environment it is overriding the
Coldbox properties in the application scope and Sports News is
displayed.
When you load "Product News" it again overrides the previously loaded
Sports News properties in the application scope and displays Products
News.
As coldbox.debugMode or any other property is one throughout the
application scope.
instead if you use
coldbox1.debugMode = true;
coldbox2.debugMode = true;
...
this will load different applications at the same time.