BML is essentially a simple macro language. Macros are called templates in BML. Templates are defined in lookup files and are invoked in BML files. Templates accept parameters and are divided into several types according to how parameters are transmitted and how the definition of the template is able to make use of them. Definitions of templates are essentially chunks of HTML with potentially more recursive BML template invocations inside them.
For LiveJournal, the most common templates are defined in the file $LJHOME/cgi-bin/bml/scheme/global.look; all other schemes either replace all of the templates, or inherit whichever is not replaced.
To write your own scheme, all you have to do is write your own BML lookup file that use the same templates as $LJHOME/cgi-bin/bml/global.look. Then, implementing a new scheme becomes pretty painless:
Procedure 18.1. Creating a new BML scheme: foo:
Create a new file under $LJHOME/cgi-bin/bml/scheme, labelled after the scheme name (foo). For example: $LJHOME/cgi-bin/bml/scheme/foo.look. This file should contain all of the BML directives you've written for your unique layout. The first line in this file should be
If you don't have a local BML configuration file (_config-local.bml) in your $LJHOME/htdocs/ directory, you should create one now. The contents of that file should look like:
Example 18.1. Sample _config-local.bml
Manually restart the apache process.
After you've written your scheme, consider adding it to the array in @LJ::SCHEMES, so that your users can use their preferred scheme.