- b2evolution CMS User Manual
- Installation / Upgrade
- Migrating from Another System
- Upgrading from Cafélog/b2
Upgrading from Cafélog/b2
If you would like to upgrade from the original b2/Cafelog (versions 0.5.x up to 0.6.2), please follow these steps:
- Do not install the current version of b2evolution right now. Instead, download b2evolution version 1.x from here.
- Follow the instructions incuded in b2evolution 1.x to upgrade from b2/Cafelog. To find those instructions, open the
/index.html
file included in b2evolution 1.x. - Come back to the current version of b2evolution by upgrading from b2evolution 1.x to the current version.
When Upgrading from Cafélog/b2 to b2evolution 1.x:
Main upgrade
Follow instructions provided with your distribution.
As always, it is very wise to do a backup of your current website / blog / database (depending on what you already have) before starting to install something new.
Template upgrade
If you had a customized template for your b2, you probably wonder how to upgrade this template in order to use it in b2evolution. Here is how to do that…
The procedure below explains how to upgrade a b2 blog template to a b2evolution blog template. If you had no blog template before, you need not worry about this.
Note: once you have upgraded your template, you will also have the option to turn that new template into an evoSkin.
Here’s how to proceed for the template upgrade:
Step 1: Tell b2evolution to use your template:
(Assume your original b2 template was called myblog.php.)
- Copy this template to your b2evolution folder.
- Then go to the back-office (/admin) and in the blogs menu edit the properties for the blog on which you want to use this template. (Below, we will assume you are doing this for blog #2)
- Set "Stub Filename" and "Stub Filename" to myblog.php.
- Set "Static Filename" to myblog.html
Step 2: Replace the old PHP b2 caller with the b2evolution caller.
Your original b2 template should typically start with
<?php
/* Don't remove this line, it calls the b2 function files ! */
$blog=1; include ("blog.header.php");
?>
Replace this with the following code instead
<?php
/*
* This is the main template to display a blog without using skins.
*/
# First, select which blog you want to display here!
# You can find these numbers in the back-office under the Blogs section.
# You can also create new blogs over there.
$blog = 2; // 2 is for "demo blog A" or your upgraded blog (depends on your install)
# Tell b2evolution you don't want to use evoSkins for this template:
$skin = "";
# This setting retricts posts to those published, thus hiding drafts.
# You should not have to change this.
$show_statuses = array();
# 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';
# Let b2evolution handle the query string and load the blog data:
require(dirname(__FILE__)."/b2evocore/_blog_main.php");
# Now, below you'll find the main template...
?>
Pay attention to the $blog = 2; setting. If you are using this template for another blog than your upgrade blog or demo blog A, you must change the number to the blog ID you want to use.
Step 3: Make the template b2evo compatible.
In the template code, you have to replace a few b2 "tags" with their b2evolution equivalents:
-
Main loop. Find the following part in your template
<?php while($row = mysql_fetch_object($result)) { start_b2(); ?>
And replace with
<?php if( isset($MainList) ) while( $MainList->get_item() ) { ?>
-
Comments, trackbacks, pingbacks. Find the following part in your template:
<!-- this includes the comments and a form to add a new comment --> <?php include ("b2comments.php"); ?> <!-- this includes the trackbacks --> <?php include ("b2trackback.php"); ?> <!-- this includes the pingbacks --> <?php include ("b2pingbacks.php"); ?>
And replace it with:
<?php // START OF INCLUDE FOR COMMENTS, TRACKBACK, PINGBACK, ETC. $disp_comments = 1; // Display the comments if requested $disp_comment_form = 1; // Display the comments form if comments requested $disp_trackbacks = 1; // Display the trackbacks if requested $disp_trackback_url = 1; // Display the trackbal URL if trackbacks requested $disp_pingbacks = 1; // Display the pingbacks if requested include( dirname(__FILE__)."/skins/_feedback.php"); // END OF INCLUDE FOR COMMENTS, TRACKBACK, PINGBACK, ETC. ?>
-
Archives. Find the following part in your template:
<?php include("b2archives.php"); ?>
And replace with:
<?php // -------------------------- ARCHIVES INCLUDED HERE ----------------------------- require( get_path('skins').'/_archives.php'); // -------------------------------- END OF ARCHIVES ---------------------------------- ?>
-
Categories. Find the following part in your template:
<?php list_cats(0, 'All', 'name'); ?>
And replace with:
<form action="<?php bloginfo('blogurl', 'raw') ?>" method="get"> <?php // -------------------------- CATEGORIES INCLUDED HERE ----------------------------- require( get_path('skins').'/_categories.php'); // -------------------------------- END OF CATEGORIES ---------------------------------- ?> <br /> <input type="submit" value="<?php echo T_('Get selection') ?>" /> <input type="reset" value="<?php echo T_('Reset form') ?>" /> </form>
You’re done for the most part!
At this time you can check your blog. It should display without serious errors.
There’s just a little more fine tuning to do…
- URL Base. If you are planning to use clean URLs for permalinks, you need to set the base URL or your relative links will be broken (including images and CSS). If not, it is recommended you do this anyway. It won’t hurt and it will be very handy when you decide to switch your template to a skin. Add the following line right after the <head> tag:
<base href="<?php skinbase(); ?>" />
- You may want to add more features to your template.
- You may also want to turn your template into an evoSkin.
Optimizing your database
If you have upgraded from b2/Cafelog, there are a few things you can do to optimize your database. This is not mandatory, it will just save a few kilobytes and make it run a tiny little bit faster. These operations can hardly be done automatically.
You need phpmyadmin, mySQL Control Center or another mySQL Administration tool to perform these:
-
Check table evo_users to see if there is an unnamed index/key on column ID that doubles the primary key. Delete that key. Do not delete the primary key!
-
Check table evo_settings to see if there is an unnamed index/key on column ID that doubles the primary key. Delete that key. Do not delete the primary key!