I am developing a theme and when go to view it, it spits out this error:

recoverable fatal error: Object of class stdClass could not be converted to string in /home/www/coquitlamcentre.com/htdocs/sites/all/themes/cqcmicrosite/page.tpl.php on line 1.

Line one is <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php print $language ?>" lang="<?php print $language ?>">

Any ideas why this is?

Comments

efolia’s picture

$language is an object. Use $language->language.

Cheers,

efolia

stephtek’s picture

you mean like this?

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php print $language->language ?>" lang="<?php print $language->language ?>">
tcconway’s picture

Thanks for this. I had the same exact issue. your html above worked perfectly.

doniking’s picture

Thanks. It works for me

webkaz’s picture

Still works. Thanks!

renamixtech’s picture

thank you! this helped me so easily & effortlessly :)

Rachel

shaven’s picture

Was converting a theme from 5.x to 6.x and it was killing me figuring out where the issue was. Thank you so much!!!

Stac...

Grammarian’s picture

I upgraded a theme from 5x to 6x and I am getting this error message, "recoverable fatal error: Object of class stdClass could not be converted to string in .../themes/litejazz/page.tpl.php on line 2." But when I looked at the page.tpl.php it looks exactly like the fix posted here. (The theme is LiteJazz from RoopleTheme.)

This is the line 2 in question:
<html xmlns="http://www.w3.org/1999/xhtml" lang="<?php print $language->language ?>" xml:lang="<?php print $language->language ?>"

Any suggestions would be appreciated!

hristos’s picture

10x I spend 1 day to find an error and you help very much