Base template

Most of, if not all lithium applications require a base.html template. The base template is just a master template on which every other template of lithium extends on. You can either use the provided templates, or write your own.

Using the default templates

To use the default templates follow these steps:

  1. Paste from lithium import templates_path into your settings.py file.

  2. Add templates_path() to the TEMPLATE_DIRS section.

    TEMPLATE_DIRS = (
        templates_path(),
    )
    

Writing your own base.html template

You will need to create a file called base.html and place it inside a TEMPLATE_DIR.

An example of a base.html template:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
    <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
    <title>{% block title %}My Website{% endblock %}</title>
</head>

<body>
    <div id="container">
        <div id="content">
            {% block content %}{% endblock %}
        </div>

        <div id="sidebar">
            ...
        </div>
    </div>
</body>
</html>

What blocks does Lithium use?

Lithium only uses two blocks, title, and content. In the title, it will place the name of a page, the title of it. Inside the content, it will insert the bulk of the page, the information.