-
Notifications
You must be signed in to change notification settings - Fork 666
Developer Guide
ginatrapani edited this page Sep 13, 2010
·
45 revisions
Welcome, developers! Here you’ll find a collection of resources to help you contribute to ThinkTank.
- Developer Guide: Get the Source Code from GitHub and Keep It Updated — Here’s how to install the ThinkTank app for use and development.
- Developer Guide: Setting Up Eclipse PDT — Not sure what IDE to use? Here’s how to set up Eclipse to work with ThinkTank. It’s free and cross-platform.
- ThinkTank Source Code Documentation — PHPDocumentor-based, auto-generated source code docs.
- Code Style Guide — Here’s what your PHP, Smarty, CSS, JavaScript, and HTML code should look like.
- Developer Guide: Data Access Objects (DAO's) – A few words on Data Access Object design
- Developer Guide: Pull Request Checklist — Got code you want merged into the ThinkTank master development tree? Run through this checklist before you issue a pull request.
- Developer Guide: File Naming Conventions
- Developer Guide: How to Change the Database Structure
- Plugins: Developer Guide
- Design Patterns
ThinkTank does not use an MVC framework, but it does employ the Model-View-Controller design pattern.
-
Model – ThinkTank’s model objects live in
/thinktank/webapp/model/. Model object filenames start with the wordclass.. For example, the Post object is located in theclass.Post.phpfile.
-
View – ThinkTank’s views are Smarty templates, files with the
.tplextension, located in the/thinktank/webapp/view/directory. As a general rule, HTML markup should never appear in a PHP file; only in a template file.
-
Controller – ThinkTank’s controllers live in
/thinktank/webapp/controller/. Each controller should extend either ThinkTankController or ThinkTankAuthController. Extend ThinkTankAuthController only if the user should be logged in to perform the action. The PHP pages which the user requests in the browser only instantiate the appropriate controller, and echo the results of itsgo()method.
ThinkTank Source Code Documentation — PHPDocumentor-based, auto-generated source code docs.
Wondering what a folder is and contains? Here’s a rundown.
- /thinktank/extlib/ – Contains external libraries that ThinkTank depends on, like Smarty
- /thinktank/extras/ – Contains “extra” ThinkTank helper scripts, like cron scripts, the WordPress plugin, and more
- /thinktank/logs/ – ThinkTank’s crawler and slow SQL logs
- /thinktank/sql/ – Database build and migration scripts
- /thinktank/tests/ – ThinkTank’s regression tests
- /thinktank/webapp/ – ThinkTank’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 ThinkTank’s controllers
- /webapp/model/ – Contains ThinkTank’s model objects
- /webapp/plugins/ – Contains ThinkTank’s plugin files
- /webapp/crawler/ – Contains ThinkTank’s data crawler
- /webapp/view/ – Contains ThinkTank’s view files, its Smarty templates
In the webapp folder, there are two key files:
- config.inc.php – ThinkTank’s single, main, configuration file
- init.php – Every controller page includes this file, which includes all the model objects and initializes global variables