|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Theme Development 1. Introduction
1.1: Base1.2: The layers 2. Development
2.1: PHP Files2.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:
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:
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.
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:
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.
|