annotate examples/trac/wiki-default/TracInterfaceCustomization @ 39:93b4dcbafd7b trunk

Copy Trac to main branch.
author cmlenz
date Mon, 03 Jul 2006 18:53:27 +0000
parents
children
rev   line source
39
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
1 = Customizing the Trac Interface =
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
2 [[TracGuideToc]]
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
3
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
4 == Introduction ==
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
5 This page is meant to give users suggestions on how they can customize the look of Trac. Topics on this page cover editing the HTML templates and CSS files, but not the program code itself. The topics are intended to show users how they can modify the look of Trac to meet their specific needs. Suggestions for changes to Trac's interface applicable to all users should be filed as tickets, not listed on this page.
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
6
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
7 == Project Logo and Icon ==
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
8 The easiest parts of the Trac interface to customize are the logo and the site icon. Both of these can be configured with settings in [wiki:TracIni trac.ini].
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
9
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
10 The logo or icon image should be put in a folder named "htdocs" in your project's environment folder. (''Note: in projects created with a Trac version prior to 0.9 you will need to create this folder'')
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
11
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
12 Now configure the appropriate section of your [wiki:TracIni trac.ini]:
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
13
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
14 === Logo ===
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
15 Change the `src` setting to `site/` followed by the name of your image file. The `width` and `height` settings should be modified to match your image's dimensions.
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
16
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
17 {{{
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
18 [header_logo]
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
19 src = site/my_logo.gif
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
20 alt = My Project
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
21 width = 300
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
22 height = 100
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
23 }}}
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
24
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
25 === Icon ===
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
26 Icons should be a 16x16 image in `.gif` or `.ico` format. Change the `icon` setting to `site/` followed by the name of your icon file. Icons will typically be displayed by your web browser next to the site's URL and in the `Bookmarks` menu.
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
27
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
28 {{{
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
29 [project]
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
30 icon = site/my_icon.ico
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
31 }}}
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
32
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
33 Note though that this icon is ignored by Internet Explorer, which only accepts a file named ``favicon.ico`` at the root of the host. To make the project icon work in both IE and other browsers, you can store the icon in the document root of the host, and reference it from ``trac.ini`` as follows:
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
34
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
35 {{{
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
36 [project]
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
37 icon = /favicon.ico
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
38 }}}
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
39
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
40 == Site Header & Footer ==
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
41 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.
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
42
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
43 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.
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
44
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
45 == Site CSS ==
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
46 The primary means to adjust the layout of a Trac site is by 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.
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
47
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
48 While you can add your custom style rules directory 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.
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
49
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
50 The following example would import a style sheet located in the `style` root directory of your host:
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
51 {{{
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
52 @import url(/style/mytrac.css);
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
53 }}}
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
54
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
55 You can use a !ClearSilver variable to reference a style sheet stored in the project environment's `htdocs` directory:
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
56 {{{
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
57 @import url(<?cs var:chrome.href ?>/site/style.css);
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
58 }}}
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
59
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
60 == Main Templates ==
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
61
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
62 It is also possible to use your own modified versions of the Trac [http://www.clearsilver.net/ ClearSilver] templates. Note though that this technique is not recommended because it makes upgrading Trac rather problematic: there are unfortunately several dependencies between the templates and the application code, such as the name of form fields and the structure of the template data, and these are likely to change between different versions of Trac.
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
63
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
64 If you absolutely need to use modified templates, copy the template files from the default templates directory (usually in found in `$prefix/share/trac/templates`) into the `templates` directory of the project environment. Then modify those copies to get the desired results.
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
65
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
66
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
67 ----
93b4dcbafd7b Copy Trac to main branch.
cmlenz
parents:
diff changeset
68 See also TracGuide, TracIni
Copyright (C) 2012-2017 Edgewall Software