-
Notifications
You must be signed in to change notification settings - Fork 672
Developer Guide
ginatrapani edited this page Sep 13, 2010
·
45 revisions
Welcome, developers! Here you’ll find a collection of material on best practices for contributing 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.
- Code Style Guide — Here’s what your PHP, Smarty, CSS, JavaScript, and HTML code should look like.
- 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
- 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/common/
Model object filenames start with the wordclass.
. For example, the Post object and Post DAO (Data Access Object) filename is calledclass.Post.php
-
View – ThinkTank’s views are Smarty templates, files with the
.tpl
extension, located in the/thinktank/webapp/templates/
directory. HTML markup should never appear in a PHP file; only in a template file.
-
Controller – ThinkTank’s controllers are the PHP files which retrieve data by instantiating DAO’s and Model objects, assign them to the templating engine, and render those views. They are located in the various folders in
/thinktank/webapp/
. For example,/thinktank/webapp/public.php
is the controller for the public timeline.
TODO: Auto-generate class documentation using PHPDocumentor, and add a link here to the resulting HTML files.
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/common/ – Contains ThinkTank’s model objects
- /webapp/plugins/ – Contains ThinkTank’s plugin files
- /webapp/crawler/ – Contains ThinkTank’s data crawler
- /webapp/templates/ – Contains ThinkTank’s view files, its Smarty templates
In the webapp folder, there are two key files:
- /webapp/config.inc.php – ThinkTank’s single, main, configuration file
- /webapp/common/init.php – Every controller page includes this file, which includes all the model objects and initializes global variables