Skip to content
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.

ThinkTank’s Model-View-Controller Implementation

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 word class.. For example, the Post object and Post DAO (Data Access Object) filename is called class.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.

ThinkTank’s Classes

TODO: Auto-generate class documentation using PHPDocumentor, and add a link here to the resulting HTML files.

ThinkTank’s Folder Structure

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
Clone this wiki locally