- b2evolution CMS User Manual
- Developer Reference
- Website Skins/Themes
- Creating evoSkins
- How to upgrade a b2evo blog template to an evoSkin
How to upgrade a b2evo blog template to an evoSkin
This man page refers to b2evolution version: 0.8.2-RC2
This explains how to make an evoSkin out of a regular blog template. Of course, you could also start from scratch by editing the custom skin.
The idea is to customize the custom skin by using your previous b2 template.
Here's how to proceed:
- Go the the /skins/custom directory
- Rename _main.php to _bak_main.php (you want to keep this handy for future reference).
- Copy your previous template (index.php, b2.php, myblog.php or whatever) and rename it to _main.php.
Pay attention: you must copy the file, not move it! We will actually split the contents of your blog template into two files!
- The original file is to become a simple stub, setting a few parameteres and then letting b2evolution call the desired skin.
Delete the template code from this file in order to just keep the beginning of the file like this:
<?php
/*
* This file is a stub for displaying a blog, using evoSkins.
* This file will fix some display parameters and then let b2evolution handle
* the display by calling an evoSkin. (skins are in the /skins folder.)
*/
# First, select which blog you want to display here!
# You can find thess numbers in the back-office under the Blogs section.
# You can also create new blogs over there. If you do, duplicate this file for the new blog.
$blog = 2; // 2 is for "demo blog A" or your upgraded blog (depends on your install)
# Now, select the default skin you want to display for this blog.
# This setting refers to a subfolder name in the '/skins' folder
$default_skin = 'custom';
# You can *force* a skin with this setting:
# $skin = 'custom';
# This setting retricts posts to those published, thus hiding drafts.
# You should not have to change this.
$show_statuses = "'published'";
# This is the blog to be used as a blogroll (set to 0 if you don't want to use this feature)
$blogroll_blog = 4;
# This is the list of categories to restrict the blogroll to (cats will be displayed recursively)
# Example: $blogroll_cat = '4,6,7';
$blogroll_cat = '';
# This is the array if categories to restrict the blogroll to (non recursive)
# Example: $blogroll_catsel = array( 4, 6, 7 );
$blogroll_catsel = array( );
# Here you can set a limit before which posts will be ignored
# You can use a unix timestamp value or 'now' which will hide all posts in the past
$timestamp_min = '';
# Here you can set a limit after which posts will be ignored
# You can use a unix timestamp value or 'now' which will hide all posts in the future
$timestamp_max = 'now';
# Additionnaly, you can set other values (see URL params in the manual)...
# $order = 'ASC'; // This for example would display the blog in chronological order...
# That's it, now let b2evolution do the rest! :)
include(dirname(__FILE__)."/b2evocore/_blog_main.php");
?>
- *Attention please:** You need to remove your current $skin=''; and set the default skin to custom.
- The new file (_main.php in the custom skin folder), on the other hand, is to become a template usable by all blogs. So you need to delete the parametering from the top of this file.
Your _main.php should actually start directly like a regular HTML/XHTML page:
<!DOCTYPE html PUBLIC "-W3CDTD XHTML 1.0 TransitionalEN" "http:www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
<head>
<base href="<?php skinbase(); // Base URL for this skin. You need this to fix relative links! ?>" />
<title>...
- Make sure you have a <base> tag in your <head> section; right after the <head> tag is best. See above.
- You may also want to add more features to your main template.