Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Data Model Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Director:addRules generates a Class not found error - Silverstripe 2.3 rc3

Go to End



Community Member, 6 Posts

17 February 2009 at 4:41am

Hello to everyone,
i am building a web multi language website on Silverstripe 2.3 release candidate 3 and i am getting this error:

Fatal error: Class 'MultiLanguage' not found in /var/www/northstargroup/sapphire/core/control/Director.php on line 259

I am following this how to avaibile on silverstripe help

MultiLanguage Class is under mysite directory and here is the code:

class MultiLanguage extends ModelAsController {
static $lang;

function init() {
$baseUrl = Director::baseUrl();
$requestUri = $_SERVER['REQUEST_URI'];
$lang = substr($requestUri, strlen($baseUrl), 2);
self::$lang = $lang;
//prevents default behaviour of redirecting to '/' for '/en/'
if($this->URLParams['URLSegment'] == "" || $this->URLParams['URLSegment'] == 'home') {
$urlparams = array('URLSegment' => 'home', 'Action' => ' ');

static function currentLang() {
return self::$lang;

protected function getField($field) {
//$lang = $this::currentLang();
$lang = "en";
$langField = $field.'_'.$lang;
if(isset($this->record[$langField])) {
return $this->record[$langField];
} else {
return isset($this->record[$field]) ? $this->record[$field] : null;

In my _config file i have added this:

Director::addRules(100, array(
'en/$URLSegment/$Action/$ID/$OtherID' => 'MultiLanguage'

but i am getting a Fatal error when i try to access pages like "" ( no problems with "" )

Any idea about it?