arturoms Posted October 24, 2006 Share Posted October 24, 2006 Hi,I am not very good at PHP and am trying to install a script but I have this problem that I just can't figure out...Code snippet:<?php// UTF-8 helper functionsrequire(dirname(__FILE__) .'/includes/utf8.php');include('Mail.php');// Translationrequire(dirname(__FILE__) .'/includes/php-gettext/streams.php');require(dirname(__FILE__) .'/includes/php-gettext/gettext.php');$input = new FileReader(dirname(__FILE__) .'/locales/'. $locale .'.mo');$l10n = new gettext_reader($input);// Standard wrappers for xgettextfunction T_($text) {global $l10n;return $l10n->translate($text);}function T_ngettext($single, $plural, $number) {global $l10n;return $l10n->ngettext($single, $plural, $number);}PHP throws 'Fatal error: Call to a member function on a non-object ..functions.inc.php on line 16' at me whenever I request this page.Code at line 16: return $l10n->translate($text);What am I doing wrong?Thanks! Quote Link to comment Share on other sites More sharing options...
Janus13 Posted October 24, 2006 Share Posted October 24, 2006 [quote author=arturoms link=topic=112492.msg456610#msg456610 date=1161655496]Hi,I am not very good at PHP and am trying to install a script but I have this problem that I just can't figure out...Code snippet:<?php// UTF-8 helper functionsrequire(dirname(__FILE__) .'/includes/utf8.php');include('Mail.php');// Translationrequire(dirname(__FILE__) .'/includes/php-gettext/streams.php');require(dirname(__FILE__) .'/includes/php-gettext/gettext.php');$input = new FileReader(dirname(__FILE__) .'/locales/'. $locale .'.mo');$l10n = new gettext_reader($input);// Standard wrappers for xgettextfunction T_($text) {global $l10n;return $l10n->translate($text);}function T_ngettext($single, $plural, $number) {global $l10n;return $l10n->ngettext($single, $plural, $number);}Thanks![/quote]One of two things. Either $l10n is not a valid class or the translate function doesn't exist inside of the class. One of the two include files has a class definition called l10n, and all functions inside that class are defined as $l10n->function() - so inside one of those files the translate function is missing, or the file that it does exist in isn't uploaded. Make sense? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.