Is there a way to package themes and modules together?

I have asked a few times now with no answers.

Ok the more I look into this the more I can see it doesn’t.

I am wondering if themes should be actual modules as well, this would allow for great control on flexibility on customizing the theme at the Admin as well.

For example, I have been looking into a theme where the landing page is a certain type of page. If I activate a theme there could be an onActivate for the theme that could check to see if the Admin menu has been set up or not. From here one could then display a settings page for this theme.

As well as set up any other menu types, like creating content for a certain content type. Like Galleries / portfolios to name a few.

The potential here would make a theme very flexible.


I have made this change, to my version. Can you see any problems with doing it this way, or is there a better way to add this? The problem I now see is that the theme.cfc will have to merge moduleConfig.cfc, as it is now a duplicate.

But at least now I have the ability to create a settings page for my theme, and provide other features that I am in the process of adding for this theme I am working on.


  • Activate the current layout in the settings
    function activateLayout(required layoutName) transactional{
    var layout = settingService.findWhere({name=“cb_site_layout”});
    // setup the new layout value
    layout.setValue( arguments.layoutName );
    // save the layout setting layout );
    // register layout interception points as we just activated it

coldboxModuleService.registerAndActivateModule(arguments.layoutName, layoutsInvocationPath);
// Get loaded configuration object
var config = coldboxModuleService.getModuleConfigCache()[arguments.layoutName];

// Call activate now if found
if( structKeyExists(config,“onActivate”) ){

// flush the settings
return this;

Let me go over these ideas as they have potential.

Cheers Luis,

If it helps here is the Wordpress theme that I was trying to create in ContentBox, as you can see it uses admin custom setup, and a photos section which is part of the Admin for this theme.

Which kind allows for the user to setup a gallery, and a slideshow on the landing page. Which is also selectable from the theme setup.

It is this type of theme that I keep hitting road blocks with ContentBox, which I expected as ContentBox is extremely young, and showing a great deal of promise very early.

hehe helps is I put the link in:-)

Quick question. Should a layout also have an event when unloaded?

So have two events:

I don’t know.

If you are thinking for cleaning up, for example removing itself from the menus etc., then I would say yes. When switching between themes, and they create menus, then they should be responsible for having a way to remove them as well when being deactivated.

If the themes are doing any database stuff, then and ondelete would maybe be needed as well, for usual clean up of itself.

I should also point out that the routes would need to work, for example the theme is fine the way it is when viewing the actual site. But if the theme uses any admin set up, events then these will need to be protected by the security interceptor as well.

I tried to get this to work with various configurations, and failed. But I tried to get it so that it was something lie


Couldn’t think of anything better.