-
Notifications
You must be signed in to change notification settings - Fork 674
Developer Guide: File Naming Conventions
When creating new files, here’s where to put them and what to name them.
Wondering what a folder is and contains? Here’s a rundown.
- /thinkup/extlib/ – Contains external libraries that ThinkUp depends on, like Smarty
- /thinkup/extras/ – Contains “extra” ThinkUp helper scripts, like cron scripts, the WordPress plugin, and more
- /thinkup/logs/ – ThinkUp’s crawler and slow SQL logs
- /thinkup/sql/ – Database build and migration scripts
- /thinkup/tests/ – ThinkUp’s regression tests
- /thinkup/webapp/ – ThinkUp’s main application folder, which should be exposed on the web via copy or symlink
The webapp folder contains several key folders:
- /webapp/controller/ – Contains ThinkUp’s controllers
- /webapp/model/ – Contains ThinkUp’s model objects
- /webapp/plugins/ – Contains ThinkUp’s plugin files
- /webapp/crawler/ – Contains ThinkUp’s data crawler
- /webapp/view/ – Contains ThinkUp’s view files, its Smarty templates
In the webapp folder, there are two key files:
- config.inc.php – ThinkUp’s single, main, configuration file
- init.php – Every controller page includes this file, which includes all the model objects and initializes global variables
ThinkUp-wide class files should be located in the /thinkup/webapp/model/
folder, with the filename class.ClassName.php
. The class and the DAO class should both appear in this file.
For example, the Post and Post DAO objects are in the /thinkup/webapp/common/class.Post.php
file.
Plugin classes should be located in the /thinkup/webapp/plugins/pluginname/lib/
directory, using the same naming convention.
ThinkUp-wide templates are located in /thinkup/webapp/templates/
with the .tpl
file extension. The template name should match the file name which calls it. Use dots to represent folders.
For example, the public.php
file calls the public.tpl
template.
The account/index.php
file calls the account.index.tpl
template.
Included template filenames should start with an underscore. For example, the header template is named _header.tpl
.
There are three basic types of tests: DAO tests, Webapp tests, and plugin tests.
TODO: Come up with naming convention for each.
Right now a dash represents a slash in test data file names.
TODO: Come up with file name conventions with appropriate replacements for /, ?, &, and =