44 | | === Trac 0.10 and below === |
45 | | |
46 | | ==== Site Header & Footer ==== |
47 | | In the environment folder for each Trac project there should be a directory called {{{templates}}}. This folder contains files {{{site_header.cs}}} and {{{site_footer.cs}}}. Users can customize their Trac site by adding the required HTML markup to these files. The content of these two files will be placed immediately following the opening {{{<body>}}} tag and immediately preceding the closing {{{</body>}}} tag of each page in the site, respectively. |
48 | | |
49 | | These files may contain static HTML, though if users desire to have dynamically generated content they can make use of the [http://www.clearsilver.net/ ClearSilver] templating language from within the pages as well. When you need to see what variables are available to the template, append the query string `?hdfdump=1` to the URL of your Trac site. This will display a structured view of the template data. |
50 | | |
51 | | Static content, needs to be put outside the ClearSilver tag. For example: |
52 | | |
53 | | {{{ |
54 | | <?cs |
55 | | ######################################################################### |
56 | | # Site footer - Contents are automatically inserted after main Trac HTML |
57 | | ?> |
58 | | <h1>TEST FOOTER</h1> |
59 | | }}} |
60 | | |
61 | | ==== Site CSS ==== |
62 | | The primary means to adjust the layout of a Trac site is to add [http://www.w3.org/TR/REC-CSS2/ CSS] style rules that overlay the default rules. This is best done by editing the `site_css.cs` file in the enviroment's `templates` directory. The content of that template gets inserted into a `<style type="text/css"></style>` element on every HTML page generated by Trac. |
63 | | |
64 | | While you can add your custom style rules directly to the `site_css.cs` file, it is recommended that you simply reference an external style sheet, thereby enabling browsers to cache the CSS file instead of transmitting the rules with every response. |
65 | | |
66 | | The following example would import a style sheet located in the `style` root directory of your host: |
67 | | {{{ |
68 | | @import url(/style/mytrac.css); |
69 | | }}} |
70 | | |
71 | | You can use a !ClearSilver variable to reference a style sheet stored in the project environment's `htdocs` directory: |
72 | | {{{ |
73 | | @import url(<?cs var:chrome.href ?>/site/style.css); |
74 | | }}} |
75 | | |
76 | | Note that this references `htdocs/style.css`, not |
77 | | `htdocs/site/style.css`. |
78 | | |
79 | | === Trac 0.11 and above === |
80 | | |
81 | | Since release [milestone:0.11], Trac is using [http://genshi.edgewall.org Genshi] as the templating engine.[[BR]] |
82 | | Therefore, customization of the interface is achieved in a slightly different way than it used to be with the ClearSilver templating engine. |
83 | | |
84 | | Documentation is yet to be written, in the meantime the following tip should work. |
| 44 | Trac is using [http://genshi.edgewall.org Genshi] as the templating engine. Documentation is yet to be written, in the meantime the following tip should work. |