cook
  • Home
     
  • About Me
     

OpenX and HostGator shared hosting

Jimmy Bourassa | March 16, 2009

This post is totally unrelated to CakePHP, but oh well!

As you might have noticed, OpenX does not work on HostGator’s default shared hosting. Every ad you post on your website through OpenX will be viewable, but clicking the ad will lead to a 403 forbidden page.

It has something to do with HostGator Apache’s default configuration on shared hosting. Globally, it is because of some configuration of mod_security, but I don’t know what it is exactly. I found out that you can’t turn off mod_security within the .htaccess. Thanksfully, the tech team will fix you up through the live support within minutes.

Comments
No Comments »
Comments rss Comments rss

Common mistakes when working with accentuated characters

Jimmy Bourassa | March 2, 2009

Working with accentuated characters in CakePHP can definitely be a pain if you’re unfamiliar with a few basic guidelines.

All your files must be encoded in UTF-8

Make sure all your files containing accentuated characters are encoded in UTF-8 (no BOM or it’ll screw everything up!). If your file does not have the correct encoding, any string that contains an accentuated character will just be considered as empty, which can be frustrating to debug.

Database connection must use UTF-8 encoding

This will prevent elements from the database to be considered as empty.

//In /app/config/database.php
class DATABASE_CONFIG {
	var $default = array(
		'driver' => 'mysql',
		'persistent' => false,
		'host' => 'some_host',
		'login' => 'some_user',
		'password' => 'some_ow',
		'database' => 'some_db',
		'prefix' => '',
		'encoding'=>'utf8'
	);
}

Set App.Encoding to UTF-8 in core.php

Actually, I’m not sure why we’re doing this, but I figured it couldn’t hurt. Everytime I start a project I make sure my App.Encoding is set to UTF-8 in core.php.

Configure::write('App.encoding', 'UTF-8');

Make sure to define the charset in your html files

Definitely not as hard to debug as the other, but remember to define the charset in your layout.

echo $html->charset();

Hope it helps!

Comments
8 Comments »
Comments rss Comments rss

Recent Posts

  • OpenX and HostGator shared hosting
  • Common mistakes when working with accentuated characters
  • Model “X” with multiple associations leading to Model “Y”
  • Sort search results by relevance
  • Redirecting to the proper page after actions

People I like

  • Jean-Philippe Doyle
  • Knowland Design
rss Comments rss valid xhtml 1.1 design by jide powered by Wordpress get firefox