wiki:TracInterfaceCustomization

Version 2 (modified by badya, 8 years ago) (diff)

--

/

tankless water heater tankless water heater tankless water heater tankless water heater tankless water heater tankless water heater tankless water heater tankless water heater tankless water heater tankless water heater tankless water heater tankless water heater tankless water heater tankless water heater tankless water heater tankless water heater tankless water heater tankless water heater tankless water heater tankless water heater tankless water heater tankless water heater american signature furniture american signature furniture american signature furniture american signature furniture american signature furniture american signature furniture american signature furniture american signature furniture american signature furniture american signature furniture american signature furniture american signature furniture american signature furniture american signature furniture american signature furniture american signature furniture american signature furniture american signature furniture american signature furniture american signature furniture american signature furniture american signature furniture value city furniture store value city furniture store value city furniture store value city furniture store value city furniture store value city furniture store value city furniture store value city furniture store value city furniture store value city furniture store value city furniture store value city furniture store value city furniture store value city furniture store value city furniture store value city furniture store value city furniture store value city furniture store value city furniture store value city furniture store value city furniture store value city furniture store blind hilton blind hilton paris star blind hilton paris star blind hilton paris star blind hilton lyric paris star blind hilton lyric paris star blind hilton lyric paris star blind drapery store american blind and wallpaper american blind and wallpaper blind by hilton lyric paris star blind by hilton lyric paris star blind design evidence evolution reveals universe watchmaker why without blind date uncensored blind date uncensored blind melon no rain blind melon no rain lifehouse blind lyric blind hilton paris star video blind hilton paris star video blind hilton paris star video blind hilton paris star dog shampoo dog shampoo dog shampoo shampoo night club shampoo night club nioxin shampoo nioxin shampoo carpet shampoo carpet shampoo dandruff shampoo dandruff shampoo dry shampoo dry shampoo natural shampoo natural shampoo nizoral shampoo nizoral shampoo herbal essence shampoo herbal essence shampoo kerastase shampoo kerastase shampoo dog shampoo hair shampoo hair shampoo hair shampoo hair shampoo hair shampoo hair shampoo hair shampoo hair shampoo sunsilk shampoo sunsilk shampoo sunsilk shampoo sunsilk shampoo hair loss shampoo hair loss shampoo hair loss shampoo hair loss shampoo free shampoo sample free shampoo sample free shampoo sample free shampoo sample free shampoo sample hair shampoo soap box derby soap box derby soap box derby soap box derby soap box derby soap box derby soap box derby soap box derby soap box derby soap box derby soap box derby soap box derby soap box derby soap box derby soap box derby soap box derby soap box derby soap box derby soap box derby soap box derby soap box derby soap box derby soap box derby sail boat for sale sail boat for sale used sail boat for sale sunfish sail boat for sale laser sail boat for sale catamaran sail boat for sale pilothouse sail boat for sale wooden sail boat for sale hunter sail boat for sale sail boat for sale by owner sail boat for sale florida catalina sail boat for sale macgregor sail boat for sale sail boat for sale sail boat for sale sail boat for sale sail boat for sale sail boat for sale sail boat for sale sail boat for sale sail boat for sale sail boat for sale buy furniture buy furniture buy direct furniture buy direct furniture nc buy furniture online buy furniture used best buy furniture buy furniture rite buy direct furniture store buy furniture office buy direct furniture buy direct furniture buy direct furniture buy furniture buy furniture buy furniture buy furniture buy furniture buy furniture buy furniture buy furniture buy furniture classic car sales classic car restoration classic muscle car for sale classic car rental classic car prices car rental italy one way car rental car seat covers las vegas car rental exotic car rental car rental france car top carriers car extended warranties car rental agencies car rental ireland ireland car rentals classic car insurance car transportation used car dealerships race car bed car rental spain infant car seats donate used car honda car parts car rental italy one way car rental car seat covers Viagra Woman Pill Viagra Prescription Viagra chrysler concorde 1999 chrysler concorde 2000 chrysler concorde 1994 chrysler concorde 1995 chrysler concorde 1998 chrysler concorde 1996 chrysler concorde chrysler concorde part chrysler concorde chrysler concorde chrysler concorde chrysler concorde chrysler concorde chrysler concorde chrysler concorde chrysler concorde chrysler concorde chrysler concorde chrysler concorde chrysler concorde chrysler concorde chrysler concorde chrysler concorde xanax xanax valium buy xanax buy xanax online 2007 nissan altima 2007 nissan altima 2006 nissan altima nissan altima recall 2005 nissan altima 2002 nissan altima 2007 altima nissan 2003 nissan altima nissan altima part nissan altima body nissan altima accessory 2000 nissan altima used nissan altima 2004 nissan altima 2001 nissan altima photo of 2007 nissan altima nissan altima se r 2006 altima nissan recall 1997 nissan altima 1995 nissan altima 1998 nissan altima 1999 nissan altima 1994 nissan altima 1993 nissan altima 2003 nissan altima recall nissan altima review 2005 nissan altima recall newport cigarette newport cigarette newport cigarette coupon newport cigarette catalog cheap newport cigarette newport cigarette official web site newport cigarette web site newport cigarette free coupon wholesale newport cigarette newport cigarette home page cheap cigarette kool menthol newport newport cigarette printable coupon carton cigarette newport discount newport cigarette newport pleasure cigarette newport cigarette goods catalog newport cigarette catalog for prize newport cigarette company cigarette newport sale carton cigarette coupon newport newport light cigarette newport cigarette online free newport cigarette newport cigarette official site newport cigarette pleasure goods catalog newport cigarette ads newport cigarette reward newport cigarette magazine 2006 catalog cigarette newport buy newport cigarette newport cigarette buy newport cigarette online newport cigarette t shirt discount birkenstock birkenstock discount discount birkenstock sandal birkenstock discount shoes discount birkenstock clog birkenstock child discount index lightning sail boat sail boat ebay sail boat sail boat clip art sail boat design sail boat supply zuma sail boat how to build a sail boat cruising sail boat mcgregor sail boat sail boat review sail boat trader laser sail boat for sale type of sail boat sail boat painting sail boat mast sail boat charter caribbean columbia sail boat tartan sail boat sail boat accessory irwin sail boat chrysler sail boat ericson sail boat sail boat name force 5 sail boat trimaran sail boat precision sail boat hobie sail boat sail boat building catamaran sail boat for sale ranger sail boat buccaneer sail boat boat community sail type sail boat race sail boat photo sail boat hardware inflatable sail boat radio controlled sail boat new sail boat sail boat insurance coronado sail boat cal sail boat hunter sail boat for sale cape dory sail boat radio control sail boat sail boat pic sail boat clipart used sail boat part thistle sail boat liveaboard sail boat sail boat wallpaper butterfly sail boat sail boat dealer islander sail boat free sail boat plan compac sail boat macgregor sail boat for sale

Customizing the Trac Interface

Introduction

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.

Project Logo and Icon

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 trac.ini.

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)

Now configure the appropriate section of your trac.ini:

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.

[header_logo]
src = site/my_logo.gif
alt = My Project
width = 300
height = 100

Icon

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.

[project]
icon = site/my_icon.ico

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:

[project]
icon = /favicon.ico

Site Header & Footer

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.

These files may contain static HTML, though if users desire to have dynamically generated content they can make use of the  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.

Site CSS

The primary means to adjust the layout of a Trac site is by add  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.

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.

The following example would import a style sheet located in the style root directory of your host:

@import url(/style/mytrac.css);

You can use a ClearSilver variable to reference a style sheet stored in the project environment's htdocs directory:

@import url(<?cs var:chrome.href ?>/site/style.css);

Main Templates

It is also possible to use your own modified versions of the Trac  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.

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.


See also TracGuide, TracIni