[coldbox-3.1.0] - Dynamic style sheets with views

Hi guys… I have a requirement to apply different style sheets to a single view within coldbox.

I could simply conditionally pass the style sheet url to the view page via the rc or url argument.

However I wondered what the standard/best approach to this would be?

Perhaps I just need pointing in the right direction .

Thanks very much guys


One idea I am toying with is having multiple layouts…

My layouts are very light since they have very little HTML… just a header.

All the content is created by renderView.

I could conditionaly go to different views in my handler so

public function showSomeStuff(event,rc,prc){
//My layout 1

//My layout 2



I think it boils down to what it is you’re actually trying to do, it seems like this is a skin for the view? There also the added bonus of viewlets and using the runEvent() inside the view, you could even use that even to add the style to the HTML header itself or other options inside the HTML Helper.


There are many more other options, for example if this is a module, you could even use an interceptor. From within that you could then do a bit of magic depending on how or what you wish to add to the output or headers.

But this should be enough to get you going.

wow… it’s taking some getting used to
coldbox is very flexible and so easy to use.

Thanks for the tips will investigate the options you proposed!

Yeah, I don’t think people fully understand the power of ColdBox and how flexible it actually is.