314
edits
ChrisCooper (talk | contribs) No edit summary |
Zachlipton (talk | contribs) No edit summary |
||
| Line 1: | Line 1: | ||
Here | Here are some notes, thoughts, and ramblings of interest to those looking to become involved with Litmus development. Feel free to add to this page and post questions or clarifications. | ||
== Architecture == | == Architecture == | ||
| Line 10: | Line 10: | ||
Litmus uses the [http://www.template-toolkit.org/ Template Toolkit] to generate its output. Templates are conveniently stored in the templates/ directory (please use caution when opening the directory, as contents may have shifted during the flight). Currently, all templates are the default templates and are written in English, but since Litmus may one day want to support localizations and customizations, the template files themselves can be found in templates/en/default. The overall configuration for the template system is located in litmus/Litmus/Template.pm. | Litmus uses the [http://www.template-toolkit.org/ Template Toolkit] to generate its output. Templates are conveniently stored in the templates/ directory (please use caution when opening the directory, as contents may have shifted during the flight). Currently, all templates are the default templates and are written in English, but since Litmus may one day want to support localizations and customizations, the template files themselves can be found in templates/en/default. The overall configuration for the template system is located in litmus/Litmus/Template.pm. | ||
Once a CGI script has done whatever retrieval or processing it needs to do, it prepares a collection of one or more variables to be sent to the template. Each template defines an interface (described in a comment at the top of the template file), indicating what variables it requires and what variables are optional (there is currently no error checking here, so things may blow up if you don't pass all required variables to a template. The script then calls Template->process(), passing it the name of the template file and the variable list. The template can then access and manipulate these variables. | Once a CGI script has done whatever retrieval or processing it needs to do, it prepares a collection of one or more variables to be sent to the template. Each template defines an interface (described in a comment at the top of the template file), indicating what variables it requires and what variables are optional (there is currently no error checking here, so things may blow up if you don't pass all required variables to a template). The script then calls Template->process(), passing it the name of the template file and the variable list. The template can then access and manipulate these variables. | ||
The template language itself is fairly straightforward. Everything that's not a template tag is just straight HTML and gets sent to the browser. Template tags are indicated with the markers <code>[%</code> and <code>%]</code>. Commands are fairly normal (IF, FOREACH, etc...), but see the [http://www.template-toolkit.org/docs/plain/index.html Template Toolkit documentation] or the existing templates for more details. To use a variable, just give its name. Methods can be invoked with the dot (.) operator. For example, if the variable named "test" contains a Litmus::DB::Test object and you want to print its testid, you can just say <code>[% test.testid %]</code>. | The template language itself is fairly straightforward. Everything that's not a template tag is just straight HTML and gets sent to the browser. Template tags are indicated with the markers <code>[%</code> and <code>%]</code>. Commands are fairly normal (IF, FOREACH, etc...), but see the [http://www.template-toolkit.org/docs/plain/index.html Template Toolkit documentation] or the existing templates for more details. To use a variable, just give its name. Methods can be invoked with the dot (.) operator. For example, if the variable named "test" contains a Litmus::DB::Test object and you want to print its testid, you can just say <code>[% test.testid %]</code>. | ||
edits