Difference between revisions of "Site schemes"

From Dreamwidth Notes
Jump to: navigation, search
(page on site schemes)
 
m (added Foundation to needs-update flag)
 
(3 intermediate revisions by 2 users not shown)
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).  
+
{{Update|text=Need to update for the half-move to Template Toolkit and for that matter for Foundation.  <code>$LJHOME/schemes</code> contains those.}}
 +
 
 +
Site schemes are [[BML]] templates that specify how your site should look and feel. They live in the [https://github.com/dreamwidth/dw-free/blob/develop/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).  
  
 
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:
 
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:
Line 14: Line 16:
 
{
 
{
 
     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?>
 
<=logo</source>
 
<=logo</source>
  
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): [http://hg.dwscoalition.org/dw-nonfree/file/tip/cgi-bin/DW/Hooks/SiteScheme.pm cgi-bin/DW/Hooks/SiteScheme.pm].
+
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): [https://github.com/dreamwidth/dw-nonfree/blob/develop/cgi-bin/DW/Hooks/SiteScheme.pm cgi-bin/DW/Hooks/SiteScheme.pm].

Latest revision as of 12:38, 1 August 2014


Needs Update: Need to update for the half-move to Template Toolkit and for that matter for Foundation. $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.