SourceForge Logo
Theme Development

1. Introduction
1.1: Base
1.2: The layers

2. Development
2.1: PHP Files
2.2: Links
2.3: Useful global vars
2.4: Icons
2.5: Smilies
2.6: Getting the data


1.1: Base
GPB started to be fast and flexible. That's why we decided that the forum should have theme support. Now it's very easy to add themes. Yust put a theme in the "themes" directory in de GPB root. Now they are available for everybody. Making themes is not that difficult, but without knoledge of PHP you won't come very far. We try to handle as many as possible on the background, so that it'll be easier to create themes. But it must stay flexible, so themes can do many, many things.

1.2: Layers
GPB consists of a backend and a frontend. The backend is the API for handling the database-, cookie- and mail functions. Also there are a lot of common used functions in it, to parse UBB tags and so on.
The databasetype doen't matter. In theory all databases supported by PHP will work if you write an implementation of it. The database implementation offers a simpel API to the frontend. The frontend is just a theme. A theme is nothing more than a couple of simpel PHP script which receive their data by calling the backend and making fancy HTML code of it.
The type of database which is used doen't matter, the API will be the same, so you don't have to care about it while developing a theme.

2.1: PHP Files
We made a big change in here. Now you can use the files you would like to. You need at least the follwing files:

FileParametersFunction
index.php-The indexpage of the forum.
profile.phpuid=[userID]To view the profile of the user with the given userID.
listtopic.phpsid=[subcategoryID]To view the topics in a given subcategoryID.
showtopic.phptid=[topicID] page=[pageID]To view the posts in a given topicID and on a given pageID.

The rest is free. But for compatability you should use the filenames used by the default GPB themes. If you have a static theme for your own site (users can't chose their own theme), you only need an index.php.

2.2: Links
You cannot use the default method of refering to other pages, because 'index.php' in the GPB root is responsible for including all the other files. If you type the follwing url: "http://www.foo.bar/gpb" the index.php will include the index.php in the users theme root, or the index.php of the default theme, in case the user isn't logged in.
If you want to make a link to an other page in your theme you have to call the index.php like this:
"<A HREF="?file=listopic.php&sid=2">subcategory 2</A>"


2.3: Useful global vars
To make life a bit easier, there are several userful global variables:

VariabelDescription
$logged_inIf is set to "1" the current user is logged in. Otherwise the user is not logged in.
$gpb_usernameIf the user is logged in, this is the username from the cookie.
$gpb_passwordIf the user is logged in, this is the password from the cookie (md5 encrypted).
$last_visitThe last visit of the current user from the cookie. This is a timestamp, so it's easy to compare it with timestamps from the database.
$user_prefs If the user is logged in, this object will keep his/her preferences:
  • $user_prefs->status: the status of the user: 0 = disabled account, 1 = member, 2 = moderator, 3 = administrator.
  • $user_prefs->show_days: the last XXX days of which topics must be shown.
  • $user_prefs->avatar_enable: if set to "1", avatars are visible, else they may not be displayed.
  • $user_prefs->language: The language the user is using (something linke "en" or "nl").
  • $user_prefs->theme: The theme the user is using (something linke "simple" or "ubb").
$forumnameThe name of the forum.
$adminmailThe e-mail address of the forum administrator.
$title_imageThe URL of the title image of the forum.
$max_topics_ppThe maximum number of topics per page.
$max_posts_ppThe maximum number of posts per page.
$show_topics_daysThe number of the last XXX day's of which topics must be shown.
$hot_topicWhen the number of posts is higher than or equal to this value, than the topic is "hot", which could result in a different icon.
$allow_custom_themeIf "1" users may choose their own theme, else they may not.
$allow_custom_languageIf "1" users may choose their own language, else they may not.
$pwd_min_lengthThe minimum number of characters of a password.
$pwd_max_lengthThe maximum number of characters of a password.
$username_min_lengthThe minimum number of characters of a username.
$username_max_lengthThe maximum number of characters of a username.
$ttitle_min_lengthThe minimum number of characters if a topic title.


2.4: Icons
The following icons are the basic GPB topic and post icons. A theme doen't have to support these icons by the way. You can also add icons if you like, but remember that other themes may not support them. This is not a problem when your forum has a static theme.

FileIDDescription
1Just a post (the default icon).
2Check this out!
3I've got an idea/discovered something.
4Notice this.
5I've got a question for ya.
6This is really cool.
7This is nice, go read it.
8I'm angry, why does this f*cking thing not work?
9I'm sad, my car wont start.
10Hehe, i'm satisfied.
11Hmm, i don't understand it anymore.
12Just kiddin', don't take it too serious.
13Kinda bad thing I suppose.
14Wow, this is good man.


2.5: Smilies
Themes have their own smilies (or emoticons). GPB has a basic iconset, which is parsed by the gpb functions. You can add your own smilies, but remember that other themes are unable to display them and you have to write your own parsing functions for it.
Icons must be placed in "images/smilies/" in your theme directory, for the build in smily parser to work.
The default iconset:

FileTextFilenameDescription
:)smile.gifThe happy icon.
:Dbiggrin.gifWow this is cool.
;)wink.gifJust kiddin
:(frown.gifHmm, i'm sad
:#mad.gifDamnit!!
8)cool.gifWow this is cool.
:oeek.gifThat doesn't look so gooed.
:ptongue.gifNanananana
:@rolleyes.gifEhhhhhh
:}redface.gifOhoh


2.6: getting the data
There's a whole bunch of functions in the GPB API. For information about what the different functions do, you should have a look at the api reference.