1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
<html>
<head>
<title>GForge Themes HOWTO</title>
</head>
<body>
<h2><center>GForge Themes HOWTO</center></h2>
<h3><center>Updated 12/30/02</center></h3>
<p>Let's say you want to create a new theme called "water". It'll be all blue-ish and clean and such.
<p>First, create a new directory <code>www/themes/water</code>. This is where your new theme will live. Now, write a PHP class called <code>Theme.class </code>that extends <code>www/include/Layout.class</code>. Like this:
<pre>
class Theme extends Layout {
require_once('www/include/Layout.class');
function Theme() {
$this->Layout();
$this->COLOR_HTMLBOX_TITLE = '#BBDDFF';
}
}
</pre>
<p>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 <code>themes</code> database table. You can see if you already have any custom themes installed by querying the database, i.e.:
<pre>
bash-2.05a$ psql -c "select * from themes;" alexandria
theme_id | dirname | fullname
----------+---------+----------
(0 rows)
bash-2.05a$
</pre>
<p>So, we don't have any custom themes installed, and we can enter a <code>theme_id</code> of <code>1</code>. The <code>dirname</code> will be <code>water</code> and the <code>fullname</code> is <code>Water</code>. Then click the Submit New Theme button and it'll be added, which you can verify with:
<pre>
bash-2.05a$ psql -c "select * from themes;" alexandria
theme_id | dirname | fullname
----------+---------+----------
1 | water | Water
(1 row)
bash-2.05a$
</pre>
<p>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?
<hr>
<p>There's an example of a Layout subclass <a href="http://savannah.nongnu.org/cgi-bin/viewcvs/gforge/gforge/www/themes/debian/Theme.class?rev=1.8&content-type=text/vnd.viewcvs-markup">here</a>.
<hr>
TODO:
<ul>
<li>Changing other stuff seems to require copying the gforge/Theme.class file over and customizing it - i.e., editing the CSS stylesheet to do what you want, changing the image root, etc.
<li>Need to include list of images with details from Ryan's post.
</ul>
</body>
</html>
|