Installation of B2evo

The following post is transferred from one of my old website built by B2evolution. I have to say it is a nice php blogging system, although I moved to WordPress. As the first website I built, B2evo presented it’s power and well-organized structure. The funny thing is that I left it just because it’s too powerful and sophisticated for a personal website. However, I prefer to leave this post on the current website, especially, for somebody new to B2evo. Maybe you will like it.

B2evolution 0.9.2 is selected to build this site.

Many resaons:

1. It’s a real multi-user, multi-lingual, multi-blog system.

2. Good language support.

On this point, b2e is the best one I ever used. Tried NucleusCMS?, which is also multi-user and multi-blog system, but the chinese language support is similar like some other blog system, such as wordpress, drupal, not good enough! Especially, the support on Chinese character searching is very bad! Although you can find some plugins to add this feature, it still has problem. e.g. the Chinese searching plugin for Drupal cannot search just one Chinese character and is not really full-text! WordPress seems better on this, but the free version is single-user.

3. XML-RPC support. B2e can do this also.

4. Looking for …

 

____________________________________________________

Installation:


1. On my server, enter fantastico interface, click to install b2e.

Extremely simple! Of course, as we can see, I build a subdomain for the blog system.

2. Change the charset on the DB server.

Go to MysqlAdmin?. By default, the collation and charset of the database tables are in latin,
not UTF8. This may bring me into trouble if I host blogs in multiple languages.
So update them to utf8. Simply, for each table, do this:

ALTER TABLE evo_antispam CONVERT TO CHARSET utf8 COLLATE utf8_general_ci;
ALTER TABLE evo_blogs CONVERT TO CHARSET utf8 COLLATE utf8_general_ci;
ALTER TABLE evo_blogusers CONVERT TO CHARSET utf8 COLLATE utf8_general_ci;
ALTER TABLE evo_categories CONVERT TO CHARSET utf8 COLLATE utf8_general_ci;
ALTER TABLE evo_comments CONVERT TO CHARSET utf8 COLLATE utf8_general_ci;
ALTER TABLE evo_groups CONVERT TO CHARSET utf8 COLLATE utf8_general_ci;
ALTER TABLE evo_hitlog CONVERT TO CHARSET utf8 COLLATE utf8_general_ci;
ALTER TABLE evo_locales CONVERT TO CHARSET utf8 COLLATE utf8_general_ci;
ALTER TABLE evo_postcats CONVERT TO CHARSET utf8 COLLATE utf8_general_ci;
ALTER TABLE evo_posts CONVERT TO CHARSET utf8 COLLATE utf8_general_ci;
ALTER TABLE evo_settings CONVERT TO CHARSET utf8 COLLATE utf8_general_ci;
ALTER TABLE evo_users CONVERT TO CHARSET utf8 COLLATE utf8_general_ci;

At last, do not forget to change the collation of the database to utf8_general_ci.

Close MysqlAdmin?. so far, all the database tables are in utf-8 format.

3. Select locales for your blogs.

Login to the backoffice of the b2e installation with the name/passwd set during the installation. Go to settings->reginal.

There you can find a table listing all the installed locales, uncheck the unwanted ones, check those you need. I need Chinese utf8, so I check it.
Thank to b2e team, the Chinese utf8 is already installed by default!

Save the settings first. Then, in the combo box “default locale”, select the desired locale. And also, set the time difference from your server time. I used 8 hour.

4. Set the default locale for each blog!

We just finish the global locale setting. But the locale setting of each blog has higher priority than the global one. The user setting is even higher.
In my case, I want one of my blog is Chinese by default, because Chinese charset is compatible to English, but not vice vesa.

Click tab “blogs”, you can see all the blogs on the server, and the locales are listed.

click the name of the blog you want to change locale, then change the setting for “main locale”, and save.

(in fact, here, the key point is how you want to show the chars on the page. if you select a locale which is using utf-8 charset also. Then the blog page can display all kinds of chars correctly. But if you choose a smaller charset, come chars stored in the database cannot be displayed normally.)

7. Make sure all the DB query are using utf8 names.

This step is very important, and code change is needed.
In the prevous steps, we already made the db and blog page in utf8 charset.
However, the english version of b2evo doesn’t use utf8 for the db connection by default! To ensure using utf8 connection, we should go to
source file in ./b2evocore/_class_db.php line 396, after

1
        // Connect to the Database:

$this->dbh = @mysql_connect($dbhost,$dbuser,$dbpassword);

, and add

1
$this->query("SET NAMES 'utf8'");

.

This will set all the following db communication using utf8 charset.
Now, we have the database, connection and front page use the same charset.
But wait, still one more thing we have to deal with.

8. Make the backoffice use utf8 too!

In the beginning, I didn’t notice this. I just thought everything should be OK. But when I made a new post in the admin interface, and checked it via MySQLAdmin?, I found the content of the post is still garbage! What’s the problem! Everything is in utf8! Wait! Is that true?

No, actually, the backoffice itself is still using iso-8859-1!

And we have to compose a new post in the backoffice. The texts input in the backoffice are not encoded by the browser. I tried if I force the browser to utf8 in the backoffice, I can success in adding a new post in utf8 which can be displayed correctly. So, the problem is how we can let the backoffice uses utf8 automatically.

Here, I did some trick. I guess, by default, the backoffice uses en-us, cause I unchecked all the other languages but en-us and utf8-chinese. so I went to the settings, clicked on the name of en-us, and force this locale use utf8 charset! OK, after logout and login, I got the backoffice worked in utf8!

I also searched on internet on how to change the default locale for the backoffice. I know there is a _locales.php under ./conf folder, in which you can change the default locale for the backoffice. The default value is “en-EU” on my server. and following that, there is an array defines all the locales installed and also the corresponding charsets! This file is only used when you reset the locale settings or a new installation. Once you customize the settings in the backoffice, this file is not used. I don’t know where the customized info is stored. But at least, you can modify the _locales.php and then reset the locale in the backoffice. That’ll work I think.

OK, in this step, we also solved the charset problem of the input interface. This time, nothing could be wrong.

9. Testing.

click the link “exit to blog” on the up right corner. We’ll see a default introduction page. To eliminate it, you should set default blog in general settings. We don’t care now.

click the link on the intro page. The blog you have changed the locale for should automatically trigger the browser to use the selected locale! If not, I don’t understand:) e.g. I set blog A to use Chinese utf8, when I click the link to blog A, the browser change its encoding from western iso to utf8. And all the other blogs that I didn’t change the locales keep the western iso encoding method. This step is a proof the local of each blog is working.

finally, you can write a post in your desired language. 谢谢!

ps: now this site is updated to b2evo 1.8.2, you can select locale during the installation process. so the above discription may be not necessary for this version! But the idea remains the same.
One thing need to notice: file permissions after installation. please refer to the online manual.

Share this:
Facebook Linkedin Twitter Digg Email

Leave a Reply