Tweaking Bitweaver

Created by: laetzer, Last modification: 17 Feb 2010 (16:03 UTC)

For advanced users! - A lot of adjustments to Bitweaver can be made by tweaking the templates files (*.tpl) of the current style. Other tweaks may require you to change PHP code. This means, your changes could break other features, or they might be lost after upgrades. Also, some tweaks might be so effective they should be included in the next release, or be their own package. Some tweaks might be so specific ("bad") that normal users shouldn't be encouraged, but alerted to use them.

Lynx style

Bitweaver uses a browser sniffing library. If a site is visited by a text browser, the style "Lynx" is automatically served to the user agent. While this is generally an advantage, it can be a disadvantage with a customized theme. The Lynx style includes certain templates that might have been excluded on purpose (like the login form, or text-based navigation links), and also brings its own doctype declaration which might not be true for the rest of the page (again, this applies only if you wrote your own theme). Certain services like browsershots.org and source code validators also receive code that didn't actually want to send them. To disable it, comment this part:

themes/bit_setup_inc.php


<?php
// if we're viewing this site with a text-browser, we force the text-browser theme
global $gSniffer;
if( !
$gSniffer->_feature_set['css1'] && !$gSniffer->_feature_set['css2'] ) {
    
$gBitThemes->setStyle'lynx' );
}
?>


UTF-8

Depending on database and server setup, getting Unicode input or output to work can be tricky. If you're using MySQL, so far there's this page about MySQL and character encoding.

FCKeditor custom files

The rich text editor FCKeditor (or CKeditor) lets you customize not only which buttons your users can see, but also which styles they can choose from (via an XML file), plus some other settings. This is discussed on FckeditorPackage.

Safe Mode etc.

If any problems with PHP's Safe Mode or open_basedir occur, the first thing that should be tried is to force the /temp/-path in kernel/config_inc.php. More about all this: InstallUnderSafeMode.

.htaccess

This file, placeed in Bitweaver's root directory, usually addresses bitweaverPerformance and Security. There's a page discussing The perfect .htaccess file for Bitweaver. See also The perfect robots.txt.

If user

You can examine your source code and find equivalent chunks in the templates, and then block them depending on the status of the user, using something like {if $gBitUser->IsRegistered()}.

This can be an advantage on smaller sites, where all the community features are reserved for a few admins or editors, and "the regular user" doesn't log in. For instance, there a some wiki pages to represent the company, looking like "normal pages", and then there's a photo gallery, but only when members of that company log in, they're actually using the power of wiki editing, version control, commenting and so on.

kernel/templates/header.tpl


<?php
{$gBitSystem->isFeatureActive'site_help_popup' )}
    {
popup_init src="`$smarty.const.UTIL_PKG_URL`javascript/libs/overlib.js"}
{/if}
?>


yourstyle/kernel/header.tpl


<?php
{if $gBitUser->IsRegistered() and $gBitSystem->isFeatureActive'site_help_popup' )}
    {
popup_init src="`$smarty.const.UTIL_PKG_URL`javascript/libs/overlib.js"}
{/if}
?>


The second code overwrites the original because of the placement of the file in the site's style folder. It avoids including a Javascript library to display help popups, although the feature is activated. You save one HTTP request and some byte overhead, making your site faster. You could do the same for the "spinner" at the bottom which belongs to the rich text editor, displaying an animated GIF. Another HTTP request gone.

Another possibility is a low-key login. This code presents a simple text link to get to the login page, or just logs the user out, if he/she was logged in already:


<?php
<a href="{$smarty.const.BIT_ROOT_URL}users/log{if $gBitUser->IsRegistered()}out.php">Logout{else}in.php">Login</a>{/if}
?>