# Error on loading website (language)

**URL:** <https://forum.getkirby.com/t/error-on-loading-website-language/9111>\
**Category:** Questions\
**Tags:** v2\
**Created:** [November 25, 2017, 8:56pm UTC](https://forum.getkirby.com/t/error-on-loading-website-language/9111 "2017-11-25T20:56:57Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![tutchi](https://avatars.discourse-cdn.com/v4/letter/t/4af34b/32.png) [@tutchi](https://forum.getkirby.com/u/tutchi)\
**Post date:** [November 25, 2017, 8:56pm UTC](https://forum.getkirby.com/t/error-on-loading-website-language/9111/1 "2017-11-25T20:56:57Z")

</div>

Hi,

When I go to my website I have a blanco page with this error:  
Fatal error: Cannot redeclare class Asset in …/kirby/branches/multilang.php on line 6

How can I resolve this?

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [November 25, 2017, 9:11pm UTC](https://forum.getkirby.com/t/error-on-loading-website-language/9111/2 "2017-11-25T21:11:22Z")

</div>

> [@tutchi](#):
>
> Fatal error: Cannot redeclare class Asset in …/kirby/branches/multilang.php on line 6

What Kirby version are you on? What PHP version? What is in your config?

---

<div class="post-metadata">

**Author:** ![tutchi](https://avatars.discourse-cdn.com/v4/letter/t/4af34b/32.png) [@tutchi](https://forum.getkirby.com/u/tutchi)\
**Post date:** [November 25, 2017, 9:14pm UTC](https://forum.getkirby.com/t/error-on-loading-website-language/9111/3 "2017-11-25T21:14:37Z")

</div>

Kirby version: 2.5.6

My config.php

```auto
    // Languages
    c::set('date.handler', 'strftime'); 
    c::set('lang.detect', true);
    c::set('languages', array(
    	array(
    		'code' => 'nl',
    		'name' => 'NL',
    		'default' => true,
    		'locale' => 'nl_NL',
    		'url' => '/'
    	),
    	array(
    		'code' => 'fr',
    		'name' => 'FR',
    		'locale' => 'fr_FR',
    		'url' => '/fr'
    	)
    ));

```

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [November 25, 2017, 9:35pm UTC](https://forum.getkirby.com/t/error-on-loading-website-language/9111/4 "2017-11-25T21:35:42Z")

</div>

It that really all that is in your config?

---

<div class="post-metadata">

**Author:** ![tutchi](https://avatars.discourse-cdn.com/v4/letter/t/4af34b/32.png) [@tutchi](https://forum.getkirby.com/u/tutchi)\
**Post date:** [November 25, 2017, 9:36pm UTC](https://forum.getkirby.com/t/error-on-loading-website-language/9111/5 "2017-11-25T21:36:47Z")

</div>

This is it all:

```
 <?php

    /*

    ---------------------------------------
    License Setup
    ---------------------------------------

    Please add your license key, which you've received
    via email after purchasing Kirby on http://getkirby.com/buy

    It is not permitted to run a public website without a
    valid license key. Please read the End User License Agreement
    for more information: http://getkirby.com/license

    */

    c::set('license', 'put your license key here');

    /*

    ---------------------------------------
    Kirby Configuration
    ---------------------------------------

    By default you don't have to configure anything to
    make Kirby work. For more fine-grained configuration
    of the system, please check out http://getkirby.com/docs/advanced/options

    */

    // Ignore cache sitemap
    c::set('cache.ignore', array('sitemap'));

    // Languages
    c::set('date.handler', 'strftime'); 
    c::set('lang.detect', true);
    c::set('languages', array(
    	array(
    		'code' => 'nl',
    		'name' => 'NL',
    		'default' => true,
    		'locale' => 'nl_NL',
    		'url' => '/'
    	),
    	array(
    		'code' => 'fr',
    		'name' => 'FR',
    		'locale' => 'fr_FR',
    		'url' => '/fr'
    	)
    ));

    // Thumbs
    c::set('thumbs.destination', function($thumb) {
    	$destination = new Obj();

    	// Create filename (copied from /kirby/toolkit/lib/thumb.php)
    	$destination->filename = str::template($thumb->options['filename'], array(
    		'extension' => $thumb->source->extension(),
    		'name' => $thumb->source->name(),
    		'filename' => $thumb->source->filename(),
    		'safeName' => f::safeName($thumb->source->name()),
    		'safeFilename' => f::safeName($thumb->source->name()) . '.' . $thumb->extension(),
    		'width' => $thumb->options['width'],
    		'height' => $thumb->options['height'],
    		'hash' => md5($thumb->source->root() . $thumb->settingsIdentifier())
    	));

    	// Thumbnail foldername
    	// TODO: Create setting like c::set('thumbs.subdirectory', 'thumbs');
    	$t = 'thumbs';

    	// Recalc URL
    	$urlPath = str_replace($thumb->source->filename(), "", $thumb->url()) . $t;
    	$destination->url	= $urlPath . '/' . $destination->filename;

    	// Create Outputdirectory if it doesn't exist
    	$outputFolder = new Folder($thumb->dir() . DS . $t);
    	if (!$outputFolder->exists())
    	$outputFolder->make(true);

    	$destination->root = $outputFolder . DS . $destination->filename;

    	return $destination;
    });

    // Prevent Kirby from acknowledging the thumbs directory as a page.
    c::set('content.file.ignore',array('thumbs'));

    // Shrink large images on upload
    kirby()->hook('panel.file.upload', 'shrinkImage');
    kirby()->hook('panel.file.replace', 'shrinkImage');
    function shrinkImage($file, $maxDimension = 2000) {
    	try {
    		if ($file->type() == 'image' and ($file->width() > $maxDimension or $file->height() > $maxDimension)) {
    			$originalPath = $file->dir().'/'.$file->filename();
    			$resized = $file->resize($maxDimension,$maxDimension);
    			$resizedPath = $resized->dir().'/'.$resized->filename();
    			copy($resizedPath, $originalPath);
    			unlink($resizedPath);
    		}
    	} catch(Exception $e) {
    		return response::error($e->getMessage());
    	}
    }
```

---

<div class="post-metadata">

**Author:** ![gillesvauvarin](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/gillesvauvarin/32/2351_2.png) [@gillesvauvarin](https://forum.getkirby.com/u/gillesvauvarin)\
**Post date:** [November 25, 2017, 9:40pm UTC](https://forum.getkirby.com/t/error-on-loading-website-language/9111/6 "2017-11-25T21:40:22Z")

</div>

I’ve got the same error message on my multilingual website (Kirby 2.5.7)

There is an issue on github :

> <https://github.com/getkirby/kirby/issues/606>

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [November 25, 2017, 9:48pm UTC](https://forum.getkirby.com/t/error-on-loading-website-language/9111/7 "2017-11-25T21:48:03Z")

</div>

Well, yes, but @tutchi said he is using K 2.5.6 and there is no call to `kirby()` in his config…

In a fresh 2.5.6 langkit with the above config.php, I can’t reproduce the error, unless I make a call to `site()` like this:

```auto
$site = site();

```

And the above config does not throw an error in a 2.5.7 langkit either.

What plugins are you using, @tutchi?

---

<div class="post-metadata">

**Author:** ![tutchi](https://avatars.discourse-cdn.com/v4/letter/t/4af34b/32.png) [@tutchi](https://forum.getkirby.com/u/tutchi)\
**Post date:** [November 25, 2017, 10:00pm UTC](https://forum.getkirby.com/t/error-on-loading-website-language/9111/8 "2017-11-25T22:00:10Z")

</div>

I’m using these plugins:

- Autopublish
- kirby-ga
- minifyhtml
- phpmailer
- uniform

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [November 25, 2017, 10:06pm UTC](https://forum.getkirby.com/t/error-on-loading-website-language/9111/9 "2017-11-25T22:06:46Z")

</div>

Is that your only config file? Are you using the recommended setting

```auto
if (kirby()->site()->user()) c::set('MinifyHTML', false);

```

anywhere?

BTW, it helps if

- you use three backticks before and after code when posting code block
- you post links to the plugins you mention

---

<div class="post-metadata">

**Author:** ![tutchi](https://avatars.discourse-cdn.com/v4/letter/t/4af34b/32.png) [@tutchi](https://forum.getkirby.com/u/tutchi)\
**Post date:** [November 25, 2017, 10:10pm UTC](https://forum.getkirby.com/t/error-on-loading-website-language/9111/10 "2017-11-25T22:10:54Z")

</div>

I found the problem.

```
// Client dashboard
if(kirby()->site()->user() && kirby()->site()->user()->role() <> 'admin') {
	c::set('panel.stylesheet', 'assets/css/custom-panel.css');
}

```

What is the error?

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [November 25, 2017, 11:09pm UTC](https://forum.getkirby.com/t/error-on-loading-website-language/9111/11 "2017-11-25T23:09:19Z")

</div>

> [@tutchi](#):
>
> if(kirby()-\>site()-\>user() && kirby()-\>site()-\>user()-\>role() \<\> ‘admin’) {  
> c::set(‘panel.stylesheet’, ‘assets/css/custom-panel.css’);  
> }

Where is this code? In another config file?

The problem is the call to `Kirby()` in the config file. It is not possible in a multilang environment, as the GitHub error shows.

---

<div class="post-metadata">

**Author:** ![distantnative](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/distantnative/32/11319_2.png) [@distantnative](https://forum.getkirby.com/u/distantnative)\
**Post date:** [February 6, 2025, 5:30pm UTC](https://forum.getkirby.com/t/error-on-loading-website-language/9111/12 "2025-02-06T17:30:27Z")

</div>


