Site schemes

From Dreamwidth Notes
Revision as of 03:59, 21 August 2012 by Foxfirefey (Talk | contribs)

Jump to: navigation, search


Needs Update: Need to update for the half-move to Template Toolkit. $LJHOME/schemes contains those.

Site schemes are BML templates that specify how your site should look and feel. They live in the cgi-bin/bml/scheme directory, although any images and CSS files they require need to be in the htdocs directory (usually in htdocs/img/schemename and htdocs/src/schemename).

Each site scheme consists of a .look file that should be a child of the global.look file. If you want to create a local version of a scheme -- to use your own site's logo, for instance -- you can do that by creating a schemename-local.look file and setting the first line to be:

_parent=>schemename.look

You can then put specific BML blocks into that file to override the blocks in the parent scheme. For instance, to change the logo, you might want to do:

logo<=
<?_code
{
    my $imgprefix = $LJ::IS_SSL ? $LJ::SSLIMGPREFIX : $LJ::IMGPREFIX;
    return "<a href='$LJ::SITEROOT/'><img src='$imgprefix/filename.png' 
        alt='$LJ::SITENAMESHORT' /></a>";
}
_code?>
<=logo

Once you create a site scheme, it can be used immediately by adding ?usescheme=schemename to the end of URLs, but that's probably not enough for your purposes. To enable it as selectable in the Display category of the Manage Accounts page, you need to create a file called cgi-bin/DW/Hooks/SiteScheme.pm and put the site schemes you want to enable in there. You can see an example in the dw-nonfree code (but since it's dw-nonfree, you need to write your own with your own list of site schemes): cgi-bin/DW/Hooks/SiteScheme.pm.