PureEdit (rocking ultra light CMS system) and utf8 / unicode support. Pagination.
Posted by valqk on
I've found PureEdit today and decided to use it as my CMS backend for some of my simpler projects!
This is a GREAT and FAST way to setup a backend content editing.
Take a look at the videos on their site! I was fascinated!
I've had old database filled with correct Unicode (UTF-8) data (in Cyrillic).
I've installed and loaded pe-admin, updated my db accortind to PureEdit specs, added some fields type like (status 1||0).
When opened pe-admin I've come up with few Unicode problems.
(as described here: http://www.pureedit.com/community/comments.php?DiscussionID=149&page=1 )
I've solved my problem exactly by putting: mysql_query('SET NAMES UTF8');
I've had to modify the connect function in pe-admin/databases/mysql.db.php like this:
function connect($host, $username, $password, $database)
{
$dbh = mysql_connect($host, $username, $password);
mysql_query('SET NAMES UTF8');
mysql_select_db($database, $dbh);
}
(it used to connect/select db in one line, but you MUST make SET NAMES BEFORE selecting db!)
The second problem that I've had as with utf8 again.
Utils class is not UTF-8 ready.
I've had to add to set utf8 encoding
public function __construct() {
mb_internal_encoding('UTF-8');
}
and replace all str functions with mb_str.
After that I wanted to have pagination.
Here it's described how to set it up.
http://www.pureedit.com/community/comments.php?DiscussionID=221&page=1#Item_0
Now I have to setup host type filed (that will be automatically filled with $_SERVER['REMOTE_ADDR']) and some othe fancy stuff, but in about 40 minutes I've setup a GREAT and easy to use backend posting solution for my website!
Thanks PureEdit
The PureEdit code is not from the greatest ones but when it works and if .htaccess protected - it simply works!
This is a GREAT and FAST way to setup a backend content editing.
Take a look at the videos on their site! I was fascinated!
I've had old database filled with correct Unicode (UTF-8) data (in Cyrillic).
I've installed and loaded pe-admin, updated my db accortind to PureEdit specs, added some fields type like (status 1||0).
When opened pe-admin I've come up with few Unicode problems.
(as described here: http://www.pureedit.com/community/comments.php?DiscussionID=149&page=1 )
I've solved my problem exactly by putting: mysql_query('SET NAMES UTF8');
I've had to modify the connect function in pe-admin/databases/mysql.db.php like this:
function connect($host, $username, $password, $database)
{
$dbh = mysql_connect($host, $username, $password);
mysql_query('SET NAMES UTF8');
mysql_select_db($database, $dbh);
}
(it used to connect/select db in one line, but you MUST make SET NAMES BEFORE selecting db!)
The second problem that I've had as with utf8 again.
Utils class is not UTF-8 ready.
I've had to add to set utf8 encoding
public function __construct() {
mb_internal_encoding('UTF-8');
}
and replace all str functions with mb_str.
After that I wanted to have pagination.
Here it's described how to set it up.
http://www.pureedit.com/community/comments.php?DiscussionID=221&page=1#Item_0
Now I have to setup host type filed (that will be automatically filled with $_SERVER['REMOTE_ADDR']) and some othe fancy stuff, but in about 40 minutes I've setup a GREAT and easy to use backend posting solution for my website!
Thanks PureEdit
The PureEdit code is not from the greatest ones but when it works and if .htaccess protected - it simply works!