-
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.
- Familiarize Yourself with ThinkTank’s Objects and Interfaces — Browse our PHPDocumentor-based, auto-generated source code docs.
- Developer Guide: File Naming Conventions — Name your files.
- Developer Guide: How to Change the Database Structure — Modify the data structure.
- Developer Guide: Data Access Objects (DAO's) – Design your data access objects.
- Developer Guide: How to Write Great Unit Tests — Test-driven ThinkTank development best practices.
- Code Style Guide — Make your PHP, Smarty, CSS, JavaScript, and HTML look good.
- Plugins: Developer Guide — Get started with plugins.
- Design Patterns — Frontend design/UI patterns to follow.
- Developer Guide: Pull Request Checklist — All done? Run through this checklist before you issue a pull request.
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