Finding your way around a Wheels application.
After downloading and unzipping Wheels, here's the directory structure that you will see:
Your configuration settings will be done in the config directory.
Your application code will end up in four of the folders, namely controllers, events, models, and views.
Place anything that need to be executed outside of the framework in the miscellaneous folder. The framework does not get involved when executing
.cfmfiles in this folder. (The empty
Application.cfctakes care of that.) Also, no URL rewriting will be performed in this folder, so it's a good fit for placing CFCs that need to be accessed remotely via
<cfajaxproxy>and Flash AMF binding, for example.
Place Wheels plugins in the plugins folder.
And the last directory? That's the framework itself. It exists in the wheels directory. Please go in there and have a look around. If you find anything you can improve or new features that you want to add, let us know!
Let's go through all of the files and directories now starting with the ones you'll spend most of your time in: the code directories.
This is where you create your controllers. You'll see two files in here already:
Wheels.cfc. You can place functions inside
Controller.cfcto have that function shared between all the controllers you create. (This works because all your controllers will extend
Wheels.cfcis an internal file used by Wheels.
This is where you create your model files (or classes if you prefer that term). Each model file you create should map to one table in the database.
The setup in this directory is similar to the one for controllers, to share methods you can place them in the existing
This is where you prepare the views for your users. As you work on your website, you will create one view directory for each controller.
If you want code executed when ColdFusion triggers an event, you can place it here (rather than directly in
Make all your configuration changes here. You can set the environment, routes, and other settings here. You can also override settings by making changes in the individual settings files that you see in the subdirectories.
Any files that you intend to deliver to the user using the
sendFile()function should be placed here. Even if you don't use that function to deliver files, this folder can still serve as file storage if you like.
For application-wide globally accessible functions
This is a good place to put your images. It's not required to have them here, but all Wheels functions that involve images will, by convention, assume they are stored here.
This is a good place to put your CSS files.
This is where unit tests for your application should go
Use this folder for code that you need to run completely outside of the framework. (There is an empty
Application.cfcfile in here, which will prevent Wheels from taking part in the execution.)
This is most useful if you're using Flash to connect directly to a CFC via AMF binding or if you're using
<cfajaxproxy>in your views to bind directly to a CFC as well.
Place any plugins you have downloaded and want installed here.
Database Migration CFC files and generated SQL files (This directory will only visible once you start using the migrator)
This is the framework itself. When a new version of Wheels is released it is often enough to just drop it in here (unless there has been changes to the general folder structure).
This file is used by Apache, and you specifically need it for URL rewriting to work properly. If you're not using Apache, then you can safely delete it. No longer included by default in 2.x
URL rewriting for version 7 of IIS. If you're not using IIS, then you can safely delete it. No longer included by default in 2.x
These are all needed for the framework to run. No changes should be done to these files.
You can add more directories if you want to, of course. Just remember to include a blank
Application.cfcin those directories. Otherwise, Wheels will try to get itself involved with those requests as well.