Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changes between Version 1 and Version 2 of TracInterfaceCustomization


Ignore:
Timestamp:
Sep 24, 2008, 4:23:35 PM (16 years ago)
Author:
trac
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • TracInterfaceCustomization

    v1 v2  
    1010The 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'')
    1111
     12 ''Note: you can actually put the logo and icon anywhere on your server (as long as it's accessible through the web server), and use their absolute or server-relative URLs in the configuration.''
     13
    1214Now configure the appropriate section of your [wiki:TracIni trac.ini]:
    1315
    1416=== Logo ===
    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.
     17Change 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 (the Trac chrome handler uses "`site/`" for files within the project directory `htdocs` and "`common/`" for the common ones).
    1618
    1719{{{
     
    3941
    4042== Site Header & Footer ==
     43
    4144In 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.
    4245
     
    4447
    4548== Site CSS ==
    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.
     49The 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.
    4750
    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.
     51While 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.
    4952
    5053The following example would import a style sheet located in the `style` root directory of your host:
     
    5861}}}
    5962
     63== Project List ==
     64You can use a custom ClearSilver template to display the list of projects if you are using Trac with multiple projects. 
     65
     66The following is the basic template used by Trac to display a list of links to the projects.  For projects that could not be loaded it displays an error message. You can use this as a starting point for your own index template.
     67
     68{{{
     69#!text/html
     70<html>
     71<head><title>Available Projects</title></head>
     72<body>
     73 <h1>Available Projects</h1>
     74 <ul><?cs
     75 each:project = projects ?><li><?cs
     76  if:project.href ?>
     77   <a href="<?cs var:project.href ?>" title="<?cs var:project.description ?>">
     78    <?cs var:project.name ?></a><?cs
     79  else ?>
     80   <small><?cs var:project.name ?>: <em>Error</em> <br />
     81   (<?cs var:project.description ?>)</small><?cs
     82  /if ?>
     83  </li><?cs
     84 /each ?>
     85 </ul>
     86</body>
     87</html>
     88}}}
     89
     90Once you've created your custom template you will need to configure the webserver to tell Trac where the template is located:
     91
     92For [wiki:TracFastCgi FastCGI]:
     93{{{
     94FastCgiConfig -initial-env TRAC_ENV_PARENT_DIR=/parent/dir/of/projects \
     95              -initial-env TRAC_ENV_INDEX_TEMPLATE=/path/to/template
     96}}}
     97
     98For [wiki:TracModPython mod_python]:
     99{{{
     100PythonOption TracEnvIndexTemplate /path/to/template
     101}}}
     102
     103For [wiki:TracCgi CGI]:
     104{{{
     105SetEnv TRAC_ENV_INDEX_TEMPLATE /path/to/template
     106}}}
     107
     108
    60109== Main Templates ==
    61110
     
    64113If 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.
    65114
    66 
    67115----
    68116See also TracGuide, TracIni