views/layouts external location - session or host based.

I’d like to implement a session (or maybe host) based views/layouts external location.

Obviously I can’t really use viewsexternallocation from my Coldbox.cfc - as that is application wide. I need this value to change based on a session, or based on cgi.http_host instead.

Has anyone any idea how I can do this; ideally I’d like to not have to touch my controllers to work out extra logic, and to rewrite every event.setView in my application(!)

Any ideas for doing this in the most elegant way (without modifying too much of the coldbox core; ideally none at all) would be appreciated.




Create an interceptor that would check your session or http_host and use
setSetting('viewsexternallocation', 'some/path'); to update views
location on every request.


Is that a suitable solution for a site that could have potentially heavy
load under multiple hosts?

Of Leonty Belskiy

No. As you are changing a singleton value. I would say to investigate the usage of modules instead and combine it with renderexternalview