## GForge Themes HOWTO

### Updated 12/30/02

Let's say you want to create a new theme called "water". It'll be all blue-ish and clean and such.

First, create a new directory `www/themes/water`. This is where your new theme will live. Now, write a PHP class called `Theme.class.php` that extends `www/include/Layout.class.php`. Like this:

    class Theme extends Layout {
     require_once('www/include/Layout.class.php');
     function Theme() {
      $this->Layout();
      $this->COLOR_HTMLBOX_TITLE = '#BBDDFF';
     }
    }

Note that we've made the box title color to a nice blue just so we can see something happen. To make the theme available, we need to add it to list of available themes. To do that, log in as the admin user, go to the admin page, click on Add, Delete, or Edit Themes, click on add_new, and add the new theme. On this page you'll see listed the column names in the `themes` database table. You can see if you already have any custom themes installed by querying the database, i.e.:

    bash-2.05a$ psql -c "select * from themes;" alexandria
     theme_id | dirname | fullname
    ----------+---------+----------
    (0 rows)

    bash-2.05a$

So, we don't have any custom themes installed, and we can enter a `theme_id` of `1`. The `dirname` will be `water` and the `fullname` is `Water`. Then click the Submit New Theme button and it'll be added, which you can verify with:

    bash-2.05a$ psql -c "select * from themes;" alexandria
     theme_id | dirname | fullname
    ----------+---------+----------
          1   | water   | Water
    (1 row)

    bash-2.05a$

Now go to the Account Maintenance page and click on the Choose My Theme link. Select the Water theme and click Submit Changes. Then click on My Page and, if all goes well, the box title bars will all have blue backgrounds. Nice, huh?

There's an example of a Layout subclass here.

TODO:

- Changing other stuff seems to require copying the gforge/Theme.class.php file over and customizing it - i.e., editing the CSS stylesheet to do what you want, changing the image root, etc.
- Need to include list of images with details from Ryan's post.