- b2evolution CMS User Manual
- Installation / Upgrade
- Upgrade
- Instructions for specific versions
- Upgrading from 0.9.x to 1.8.x
Upgrading from 0.9.x to 1.8.x
Make sure you start by following the general upgrade instructions.
Once the new version is installed, you may need the information below for fine tuning…
Stub files
Overall, stub files remain the same. However, since the file organization has changed a little, you will need to replace this:
require(dirname(__FILE__)."/b2evocore/_blog_main.php");
with this:
require_once dirname(__FILE__).'/conf/_config.php';
require $inc_path.'_blog_main.inc.php'
Skins
If you only have a small customizations to your 0.9 skin, it may be easier to just take a default 1.8 skin and apply the modifications again. Otherwise, if you want to evolve your 0.9.2 skin into an 1.8 skin, here are the changes that you will need to apply…
Skin files
In the folder of your skin, you can delete the following files:
_archives.php
_calendar.php
_categories.php
The functionality which was in these files is now handled by plugins. (The necessary plugins are shipped with b2evo 1.8).
Also, please make sure you use new versions of the following files (you could take the ones in the custom skin for example):
_arcdir.php
_bloglist.php
_feedback.php
_lastcomments.php
_linkblog.php
_profile.php
Since these files are rarely modified, we do not discuss changes in detail. If needed, please diff the files with their counterparts from the custom skin.
Skin’s _main.php
Here are the changes you will need to apply to _main.php:
First line
This is probably, the most important single change. Failing to do so will generate a blank page with the message "Please, do not access this page directly." when trying to access the blog. Many people have reported this "problem", but it is very easyto fix! Just find this line at the beginning of your skin’s _main.php:
if( !defined('DB_USER') ) die( 'Please, do not access this page directly.' );
and change it to:
if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
Content Type
Add the content type just after the line above, like this:
if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
skin_content_header(); // Sets charset!
?>
Also locate this: (Note this line should be before the <title> tag)
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php locale_charset() ?>" />
<title>
and replace with this:
<head>
<?php skin_content_meta(); /* Charset for static pages */ ?>
<?php $Plugins->trigger_event( 'SkinBeginHtmlHead' ); ?>
<title>
More info: skin_content_header(), skin_content_meta()
Base tag
In the HEAD section, locate this:
<base href="<?php skinbase(); /* Base URL for this skin. You need this to fix relative links! */ ?>" />
and replace with this:
<?php skin_base_tag(); /* Base URL for this skin. You need this to fix relative links! */ ?>
Page title
Optional. Generating a clean title for your page has gotten easier. You could just use this:
<title><?php
$Blog->disp('name', 'htmlhead');
request_title( ' - ', ' ', ' - ', 'htmlhead' );
?></title>
On the page, you could also generate an H2 title like this:
<?php
// ------------------------- TITLE FOR THE CURRENT REQUEST -------------------------
request_title( '<h2>', '</h2>' );
// ------------------------------ END OF REQUEST TITLE -----------------------------
?>
Messages
B2evo 1.8 can display messages like "Your comment has been posted but it will only appear once it has been approved by a moderator". For these messages to appear, you will need to add this code somewhere on your page (presumably at the top, near the call to request_title()):
<?php
// ------------------------- MESSAGES GENERATED FROM ACTIONS -------------------------
if( empty( $preview ) ) $Messages->disp( );
// --------------------------------- END OF MESSAGES ---------------------------------
?>
You might want to look for request_title( … ) and put the Messages code just before request_title()
Permalinks
Locate all occurences of:
$Item->permalink()
and replace them with:
$Item->permanent_url()
For more information see the tech doc for permanent_url(). Alternatively, you may want to use permanent_link() which can create a whole link, not just an URL, in a single call.
Author name
Locate:
$Item->Author->preferred_name();
and replace with:
$Item->author( '', '' );
More info: $Item->author()
Calendar
Locate this:
<?php // -------------------------- CALENDAR INCLUDED HERE -----------------------------
require( dirname(_FILE_).'/_calendar.php' );
// -------------------------------- END OF CALENDAR ---------------------------------- ?>
And replace with this:
<?php
// -------------------------- CALENDAR INCLUDED HERE -----------------------------
// Call the Calendar plugin:
$Plugins->call_by_code( 'evo_Calr', array( // Params follow:
'block_start'=>,
'block_end'=>,
'title'=>, // No title.
) );
// -------------------------------- END OF CALENDAR ----------------------------------
?>
Categories
Locate this:
<?php // -------------------------- CATEGORIES INCLUDED HERE -----------------------------
require( dirname(__FILE__).'/_categories.php' );
// -------------------------------- END OF CATEGORIES ---------------------------------- ?>
and replace with this:
<?php
// -------------------------- CATEGORIES INCLUDED HERE -----------------------------
// Call the Categories plugin:
$Plugins->call_by_code( 'evo_Cats', array( // Add parameters below:
) );
// -------------------------------- END OF CATEGORIES ----------------------------------
?>
Archives
Locate this:
<?php // -------------------------- ARCHIVES INCLUDED HERE -----------------------------
require( dirname(__FILE__).'/_archives.php' );
// -------------------------------- END OF ARCHIVES ---------------------------------- ?>
and replace with this:
<?php
// -------------------------- ARCHIVES INCLUDED HERE -----------------------------
// Call the Archives plugin:
$Plugins->call_by_code( 'evo_Arch', array( // Add parameters below:
) );
// -------------------------------- END OF ARCHIVES ----------------------------------
?>
Logging hits
Locate this:
log_hit(); // log the hit on this page
and replace with this:
$Hit->log(); // log the hit on this page
That’s it ;)
CSS
If your CSS file imports styles from the /rsc/ folder, be aware that these styles have now moved to /rsc/css/
Optionally, you may want to add the following styles to your custom CSS file:
Style for the messages:
div.action_messages {
margin: 0 2ex;
}
Style for the comment preview button: input.preview You probably already have a style for submit and reset like this:
input.submit,
input.reset {
If you want to appluy the same style to the preview button, just insert it like this:
input.submit,
input.preview,
input.reset {
Same for input.preview:hover