CodeIgniter – Cart crap with Cyrillic characters
Ok, now this is so ridiculous that I have to blog about this even though I do not want to. CodeIgniter just blew my mind some time ago when I upgraded to 1.7.2 for the new Cart library. I realize, that it is a basic functionality, yet still... It does not support cyrillic characters in the product name! It is freaking 2009, almost 2010 and one of the most popular MVC frameworks does not support cyrillic? And I bet any other "strange" characters too, because basically they have a filter there with a regexp:
var $product_name_rules = '\.\:\-_ a-z0-9';
Now that is some serious shit!
Anyway, if you have trouble with the same thing - doing non-latin chars in product names just find and comment out the following part from system/libraries/Cart.php:
if ( ! preg_match("/^[".$this->product_name_rules."]+$/i", $items['name']))
{
log_message('error', 'An invalid name was submitted as the product name: '.$items['name'].' The name can only contain alpha-numeric characters, dashes, underscores, colons, and spaces');
return FALSE;
}
Also, if you are using a database table for your sessions - do not forget to check that the user_data field uses UTF-8 as its encoding (otherwise it won't let cyr chars into the field).
Image / file upload with CodeIgniter
Image upload can be a pain in the *ss. And even though CI has a lot to offer (in the means of documentation) it still lacks a direct copy-paste code on their website so that people can just put it into their controller and use away.
Here we will have:
- Image upload form with 5 images
- And a controller function that will upload those
- Thumbnails will be there too
Web development tools I use and recommend
Ok, not being original here, but still... a web developer's blog is never complete without this. Maybe somebody will find at least something useful here. So here goes:
Tasks
- slicing designs into images and cobining it to (X)HTML/CSS
- script writing (PHP / JavaScript)
- debugging
- testing IE compatibility
- quick editing
- database handling
- OS: Microsoft Windows
- others
A bit of MODx CMS criticism
Today I am going to talk about MODx CMS again. Now, the first post on this topic covered my first impressions of this product. And now I have something else to say.
This time I am going to go a bit deeper into minuses of MODx. Why? Well, all the pluses are available on the official website and I do not see the reason for repeating those. This post does not in anyway mean that MODx is a bad product! It just has some bad sides that I would find very useful to read about before starting to build a website based on this system. This post is healthy citicism and maybe a precaution for those wondering what can't you do with MODx.
MODx CMS overview
Some MODx related post discussing MODx cons is also here.
0. Intro
Today I am going to say something about MODx CMS.
At the moment I have used it to make one website as well as I am using it right now to make another. This is mainly the suggestion of the client, so I am using it not because I like it so very much, but just because of circumstances.
So far my experience with it is, actually, quite pleasant. MODx CMS has a lot of fine features. At the moment I can tell that it at least has the minimal things that are required to make a website. So far I have understood, that most of the MODx functionality relies on the following things: templates, template variables (TV), chunks and snippets. All the other things are quite auxiliary.
So, let us take a look and see what those are.