Session X - Advanced Templates
IMPRS Be Smart Summer School
2023-08-09
Templates are HTML files that contain the text and variables that are displayed to the participant
They are not actual HTML files, but rather HTML files with special syntax which oTree fills some special parts
<p>
: ParagraphsThis is a paragraph
This is another paragraph
<strong>
: Bold<em>
: Italics<strong> This is bold </strong>.
<em> This is italic </em>.
You can mix <strong> bold </strong> and <em> italics </em>.
This is bold .
This is italics .
You can mix bold and italics .
<h1>
, <h2>
, <h3>
, <h4>
, <h5>
, <h6>
: Headings<h1> Super title </h1>
<h2> Less super title </h2>
<h3> Even less super title </h3>
<h4> An okay title </h4>
<img>
: ImagesNot robots
<ul>
: Unordered list<table>
: Table<tr>
: Table row<td>
: Table data1 | 2 | 3 |
4 | 5 | 6 |
Bootstrap is a popular CSS framework that makes it easy to make your templates look good
oTree comes with Bootstrap already installed and loaded
<style>
tag.<div>
: A division or section in an HTML documentpgg
app and modify the template so that it looks like this:
<ul> <li> </li> </ul>
<strong>
in two places for boldlive preview
JavaScript is a programming language that adds interactivity to your pages
You can add them to your templates by using <script>
tag
Example:
It takes a bit more than this session to learn JavaScript so we will not cover it in detail
Oftentimes you can find examples of JavaScript code online and copy-paste them to your templates
It runs on the client side (browser)
formfields
from the page