Creating a theme for Geeklog is easy and quite fast. The code, contents, theme (it is identical with the word 'layout' here ) and system language are properly separated.
If you know beginners level HTML and simple CSS then you can create a theme! There's no need to learn PHP / MySQL nor complicated CSS.
First, copy all the files of the existing professional theme (more than 200 files in 27 folders) to a new directory. No spaces are allowed in the new theme name!
Your existing theme is here: public_html/layout/professional
The new theme may be here: public_html/layout/my_new_theme
Keep the original professional theme on your webspace! This is good for trouble shooting.
Now edit the thtml files to suit your needs. The thtml files are more or less HTML files with CSS and some JavaScript at times. The directory you just created (my_new_theme) holds ALL templates Geeklog needs apart from those being used by plugins. You will only need to modify a small few to make a huge impact on the look.
In particular these are the templates you will undoubtedly want to change:
Maybe also:
You will wonder why Geeklog has so many more theme files when other CMS have a total of just 1 or 2. The reason is quite simple, you can change almost every corner of Geeklog also in the administration area.
When rendering a theme, Geeklog starts with header.thtml which builds the site's header and then goes on to include the left column of blocks (look for the variable and the leftblocks.thtml file). The middle part of a site consists of the stories which are built using the storytext.thtml and storybodytext.thtml (for normal stories) and featuredstorytext.thtml and featuredstorybodytext.thtml (for featured stories) template files. The footer.thtml file then builds the right column of blocks (variable , file right_blocks.thtml) and the site's footer. Blocks themselves consist of the blockheader.thtml and blockfooter.thtml files.
The above only describes how Geeklog's main page and stories are rendered. More templates exist for the various editors and lists you will see in Geeklog, as well as for the calendar and almost every other part of Geeklog.
There is currently no complete list available that explains which template file is used for which part of Geeklog. However, in most cases the use should be obvious when you have a look at the file and directory names in your theme's layout directory. If you're unsure which template file is used to render a certain part of Geeklog, have a look at the URL. You will notice the name of a PHP file there, e.g. the users.php file when you view a user's profile. Open that file and search for '.thtml'. For the profile you will find these lines (in function userprofile()):
$user_templates = new Template ($_CONF['path_layout'] . 'users');
$user_templates->set_file (array ('profile'=>'profile.thtml', 'row'=>'commentrow.thtml', 'strow'=>'storyrow.thtml'));
You don't need to understand PHP code to see that this uses the template files profile.thtml, commentrow.thtml, and storyrow.thtml. The first line also indicates that these are taken from the users directory within the theme's layout directory.
An incomplete list of variables that can be used in templates files is also included. Testing a theme and further information
After you have edited your themes, you are now ready to test it out. Simply go to http://mygeeklogsite/usersettings.php?mode=preferences - in the theme drop-down select your newly created theme (note the name of your theme is the same name as the directory for your theme).
Finally, you may want to update the logo and other images in your theme's images directory.
For the template system we are using PHPLib's template class (http://phplib.sourceforge.net/). Read their documentation and, optionally, look at /path/to/geeklog/system/classes/template.class.php to see how it is implemented. Even with this knowledge it may not be clear which templates are used in conjunction with one another (i.e. storybody.thtml and storybodytext.thtml together make up the complete format of a single story). If you have questions join our mailing list at http://lists.geeklog.net/listinfo/geeklog-users or check us out in IRC at irc.freenode.net in #geeklog.
Themes and WYSIWYG editors: The template files used by Geeklog are not complete HTML files - they contain only parts of the HTML that Geeklog puts together to build a proper HTML document. This, however, seems to confuse some WYSIWYG HTML editors and some of them tend to add the HTML which they think is missing from the file, thus making it unusable for Geeklog. We suggest you use a simple text editor to edit your themes.
PHP in themes: You can use PHP in the header of a theme, i.e. in the header.thtml file. If you want to use custom PHP functions, you can put them in the file functions.php within your themes directory.
Different look for left and right blocks: You can give the blocks on the left and right a different look. See this post on the Geeklog.net forum for details.
Polls: To use multi-colored bars in the graphical display of poll results, you can use the and variables in the pollbooth/pollvotes_bar.thtml template file. will be replaced with a running number for each answer, hence bar.gif would result in bar1.gif, bar2.gif, etc. Giving each of those GIFs a different color would give you a different color for each answer. will alternate between 0 and 1 for every answer, hence bar.gif will result in bar0.gif for the first, third, fifth, etc. answer and bar1.gif for the second, fourth, etc. answer.
Left blocks in the right column: $_CONF['left_blocks_in_footer'] (in config.php) is a rather curious option. It makes the variable available in the site's footer (i.e. footer.thtml) while at the same time disabling it in the header (header.thtml). The idea is that this can be used for two-column layouts (one column for the blocks and one column for the content) but when you want to have the blocks on the right side. Simply moving all blocks to the right will not work as expected, as you'd end up with no blocks at all on those pages that normally only display the left blocks (e.g. article.php or the admin pages). Setting $_CONF['left_blocks_in_footer'] = 1 will fix this, so that the blocks, while internally still treated as left blocks, will actually be displayed on the right.
The theme's header.thtml, footer.thtml, and leftblocks.thtml will probably need some adjustments. It is also recommended to leave the $_CONF variable unchanged in config.php and overwrite it in the theme's functions.php instead. That way, you can even leave your users a choice between, for example, a “normal” theme and one with the blocks on the right.
Error Message: Since Geeklog 1.4.1 it is possible to control what HTML is displayed to non-root users in the event of an error occurring (a crash bug). To do so, you need to change the function CUSTOM_handleError in lib-custom.php to output any HTML you like.
Search
The templates for the search form and search results have been changed and new template files have been added for the new display modes of the search results. We suggest to replace the entire search subdirectory in your theme with a copy of the directory from the Professional theme as it ships with Geeklog.
Comments
The commentform.thtml and commentform.thtml template files were changed to include a security token and a {notifcation} variable (for the new option to be notified of followup comments). Plugins
Permissions Editor
The various instances of the Permissions Editor (where you can set the Read / Edit permissions for Owner, Group, Members, Anonymous) were using slightly different template variable names. From now on, the following names are defined everywhere:
Template files using the alternative names will continue to work, but new files should use the above names from now on.
Note: Themes made for Geeklog 1.5.0 or 1.5.1 should work just fine with Geeklog 1.5.2. In this release, we only fixed a few problems in the themes (detailed below) that also affected 1.5.0 and 1.5.1. The other changes listed here are optional.
Bugfixes
These changes are actual bugs in the template files that also exist in Geeklog 1.5.0 and 1.5.1. We recommend making these changes to all custom themes.
Other changes
These changes are optional. They fix cosmetic issues or issues that only affect some setups.
(Variables)
Note: Themes made for Geeklog 1.5.0 are mostly compatible with Geeklog 1.5.1. We only made one mandatory change (for the Configuration admin panel) - all the other changes listed below are optional or adjustments for special setups (e.g. multi-language sites, right-to-left languages). See details below.
Important change: Configuration
The JavaScript code used for the Configuration admin panel used a generic name which caused conflicts with other JavaScript code. You should update the file admin/config/config_element.thtml to make sure your theme works with Geeklog 1.5.1. Multilingual blocks
The multi-language support for blocks introduced in Geeklog 1.5.1 relies on disabled blocks being swapped in dynamically. If you are using Geeklog's multi-language support, you may need to modify the piece of PHP code in your theme's functions.php so that it picks the correct templates for these multilingual blocks:
$lang = COM_getLanguageId();
if (empty($lang)) {
$result = DB_query("SELECT onleft,name FROM WHERE is_enabled = 1");
} else {
$result = DB_query("SELECT onleft,name FROM ");
}
Prior to Geeklog 1.5.1, you will probably only find the first SQL request in your functions.php file.
Other changes
XHTML support
Geeklog now supports XHTML compliant themes. These themes should define the following constant in their functions.php file:
define('XHTML', ' /');
This will ensure that Geeklog switches to XHTML internally. If you want your theme be working both as an HTML and an XHTML theme, you should use the variable wherever XHTML requires a self-closing tag, e.g. <br /> would be written as <br>. If you don't plan to use the theme for HTML, feel free to hard-code your theme for XHTML only.
Note: If you're using XHTML, it is your responsibility to ensure that your site's content (stories, comments, etc.) is XHTML compliant. Geeklog does not convert your content to XHTML. “Contribute” - User submitted stories
Geeklog 1.5.0 supports the ability for users to specify story intro text and body text seperately rather than just the intro text. This can be turned on and off by changing the templates. The files:
Contain table rows containing the bodytext inputs. Simply removing these inputs returns behaviour to the original. Admin Menu, User Menu & Topic List
All the above mentioned items are now lists, using ul and li tags (and a new CSS class, blocklist, to hide the list bullets). Two new template files have been added to create these blocks:
Please note that the variable that was present in pre-release versions of Geeklog 1.5.0 has since been removed. Security Changes
Many forms, particularly in the admin section of the site need a new hidden form field in order for saving the form/processing the action to work. Add:
<input type=“hidden” name=”” value=””>
To the following templates:
Some plugin specific templates have also been changed, you may also need to check:
Removed Files
The following template files have been removed and are no longer needed:
System Message
The previously hard-coded CSS for the System Messages has been moved to the stylesheet (new CSS class sysmessage).