Difference between revisions of "Site schemes"
(page on site schemes) |
(fix category, wrap code) |
||
Line 1: | Line 1: | ||
[[Category: Development]] | [[Category: Development]] | ||
− | [[Category: Dreamwidth Installation] | + | [[Category: Dreamwidth Installation]] |
Site schemes are [[BML]] templates that specify how your site should look and feel. They live in the [http://hg.dwscoalition.org/dw-free/file/tip/cgi-bin/bml/scheme/ 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). | Site schemes are [[BML]] templates that specify how your site should look and feel. They live in the [http://hg.dwscoalition.org/dw-free/file/tip/cgi-bin/bml/scheme/ 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). | ||
Line 14: | Line 14: | ||
{ | { | ||
my $imgprefix = $LJ::IS_SSL ? $LJ::SSLIMGPREFIX : $LJ::IMGPREFIX; | my $imgprefix = $LJ::IS_SSL ? $LJ::SSLIMGPREFIX : $LJ::IMGPREFIX; | ||
− | return "<a href='$LJ::SITEROOT/'><img src='$imgprefix/filename.png' alt='$LJ::SITENAMESHORT' /></a>"; | + | return "<a href='$LJ::SITEROOT/'><img src='$imgprefix/filename.png' |
+ | alt='$LJ::SITENAMESHORT' /></a>"; | ||
} | } | ||
_code?> | _code?> |
Revision as of 09:12, 4 August 2009
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.