Jump to content


Photo

Fatal error: Call to a member function on a non-object. Pls help me!


  • Please log in to reply
1 reply to this topic

#1 arturoms

arturoms
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 24 October 2006 - 02:04 AM

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 functions
require(dirname(__FILE__) .'/includes/utf8.php');

include('Mail.php');

// Translation
require(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 xgettext
function 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!

#2 Janus13

Janus13
  • Members
  • PipPipPip
  • Advanced Member
  • 54 posts

Posted 24 October 2006 - 02:20 AM

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 functions
require(dirname(__FILE__) .'/includes/utf8.php');

include('Mail.php');

// Translation
require(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 xgettext
function T_($text) {
global $l10n;
return $l10n->translate($text);
}

function T_ngettext($single, $plural, $number) {
global $l10n;
return $l10n->ngettext($single, $plural, $number);
}

Thanks!


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?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users