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! Link to comment https://forums.phpfreaks.com/topic/24894-fatal-error-call-to-a-member-function-on-a-non-object-pls-help-me/ 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? Link to comment https://forums.phpfreaks.com/topic/24894-fatal-error-call-to-a-member-function-on-a-non-object-pls-help-me/#findComment-113455 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.