views:

163

answers:

2

Is there a recommended location to store static resources (images, css, js, etc) in a DotNetNuke 5.x installation?

There are /images and /js folders as well as a /Resources folder that contains resources. There appears to be some overlap as MicrosoftAjax.js is in multiple locations (but might be different versions?). I also could put resources in a /DesktopModule/ModuleX location.

Does anyone know if there is a difference in using any of these folders?

I kinda like the idea of all static resources being under a common folder (/Resources) so I could set caching rule headers, permissions, etc on them in one place.

Has anyone used a separate image server to serve DotNetNuke static content? http://stackoverflow.com/questions/913208/pros-and-cons-of-a-separate-image-server-e-g-images-mydomain-com

+3  A: 

If you own the entire DNN installation, then it can certainly make sense to consolidate all of your resources into one place (whether its the Resources folder used by DNN, or a different folder that DNN doesn't know about). If you're developing a module that will be installed onto a site that you don't totally own, then the considerate thing to do is to constrain your resources within the DesktopModules folder for your module.

Some things to consider with regards to DNN folders:

  • If you have content under a module's folder, uninstalling that module will give you the option to delete that content. This can help you keep things clean and organized, or it can make it can be dangerous if you have multiple module definitions sharing the same files... (Even more dangerous can be the uninstall SQL scripts; make sure you don't accidentally uninstall a module which has an uninstall script attached)
  • You can use the DNN file manager to upload/delete/rename files within the Portals directory, so it may make sense to put files there if site administrators should have control of them
  • Putting content outside of the module's folder will make it slightly more difficult to link to (especially if it's on a portal specific folder, i.e. you have to ask the PortalSettings object for the path every time)
  • It's uncommon to keep resources outside of the module's folder, and so may cause confusion if you bring an experienced DNN developer into the project
bdukes
We do own the entire DNN installation and are developing modules that only we will use (no distributing, selling, etc.). Many of these resources will be used by multiple modules. I will go with using the /Resources DNN folder. Thanks!
Joosh21
+1  A: 

For skins and containers, you can use their own folders under the Portals directory. As bdukes said, this way site administrators can control them within DNN.

For modules, I have used the module's folder and module.css for defaults that can be overridden by skin or container css. This works because skin and container css are loaded after the module.css.

mika