Style (CSS) and Eloquence (Languages)

From EPrints Documentation
Revision as of 14:04, 5 December 2010 by Pm705 (talk | contribs) (Creating the theme)
Jump to: navigation, search

EPrints has a rather complex hierachy of style sheets. You have eprints default styles which is then overwritten (where appropriate) by a local theme which is then overwritten in turn by your repositories local style sheets. Themes have been around since EPrints 3.0 but they are almost never used because very few people ever style more than one repository. Themes are a pack of style sheets, images, templates, static pages, and javascript which can completely change the look and feel of an EPrints repository. In EPrints 3.3 themes have been revisited and polished up so that they can be easily made into EPrints Bazaar packages.

In this tutorial we will focus on how to make your own theme which can be packaged for the EPrints Bazaar.

Creating the theme

You will need to start by creating your own theme directory. In this tutorial my theme name will be "abstract_flash" so the directory I will create for my theme is <eprints_root>/archives/<archive_name>/cfg/themes/abstract_flash/

Adding a style sheet

The first and easiest thing to do is create a new style sheet for our theme. In EPrints 3.2 the default template has been changed to make the things you can do with CSS styles much more powerful.

Create a stylesheet in your theme's directory: <eprints_root>/archives/<archive_name>/cfg/themes/abstract_flash/static/style/auto/y_abstract_flash.css

Try out some simple style rules to change the appearance of your EPrints template. If you aren't comfortable with CSS or you're just feeling lazy you can copy my code from the box below.

.ep_tm_archivetitle {
        display: block;
        padding: 10px;
        color: #D4FAE7;

.ep_tm_menu, .ep_tm_header {
        background: none repeat scroll 0 0 #525252;

.ep_tm_logo {
        display: none;

.ep_tm_menu li {
        padding: 20px;
        display: inline-block;
        border-top: 2px solid white;

.ep_tm_searchbar {
        background: none repeat scroll 0 0 #D4FAE7;
        border-top: 1px solid #525252;
        border-bottom: 1px solid #525252;

.ep_tm_key_tools li a {

body {
        margin: 0;

Changing the template

Our theme can also contain a template. The template is the frame in which pages are displayed.

I suggest copying your template file from the lib directory lib/templates/default.xml. The template can go in either cfg/themes/abstract_flash/templates/default.xml or cfg/themes/abstract_flash/lang/[langid]/templates/default.xml (if you want a language specific template)

In this example I have moved the key tools bar so that it is a menu on the right of the screen. To do this you must edit your template and move the "login_status" pin from inside the search bar to below it. This exert shows what I have done:

 <table class="ep_tm_searchbar">
      <td> <!-- login_status pin was here--> </td>
      <td align="right" style="white-space: nowrap">
                <epc:pin ref="languages" />
        <form method="get" accept-charset="utf-8" action="{$config{http_cgiurl}}/search" style="display:inline">
          <input class="ep_tm_searchbarbox" size="20" type="text" name="q"/>
          <input class="ep_tm_searchbarbutton" value="Search" type="submit" name="_action_search"/>
          <input type="hidden" name="_action_search" value="Search"/>
          <input type="hidden" name="_order" value="bytitle"/>
          <input type="hidden" name="basic_srchtype" value="ALL"/>
          <input type="hidden" name="_satisfyall" value="ALL"/>

<epc:pin ref="login_status"/>

You must reload your configuration for this change to take affect.

You should now find that login information is outside of the search search bar area. Now we apply some style rules to position it on the right and make it look slightly more attractive. The style rules i chose are below.

.ep_tm_key_tools {
        width: 200px;
        float: right;
        background: none repeat scroll 0 0 #D4FAE7;
        border-left: 1px solid #525252;
        border-bottom: 1px solid #525252;

.ep_tm_key_tools li, .ep_tm_key_tools li:first-child {
        font-size: 110%;
        display: block;
        padding: 10px;