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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lowbotpro
    New Member
    • Oct 2006
    • 2

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

    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.p hp');

    // Translation
    require(dirname (__FILE__) .'/includes/php-gettext/streams.php');
    require(dirname (__FILE__) .'/includes/php-gettext/gettext.php');
    $input = new FileReader(dirn ame(__FILE__) .'/locales/'. $locale .'.mo');
    $l10n = new gettext_reader( $input);

    // Standard wrappers for xgettext
    function T_($text) {
    global $l10n;
    return $l10n->translate($tex t);
    }

    function T_ngettext($sin gle, $plural, $number) {
    global $l10n;
    return $l10n->ngettext($sing le, $plural, $number);
    }


    PHP throws 'Fatal error: Call to a member function on a non-object ..
    functions.inc.p hp on line 16' at me whenever I request this page.
    Code at line 16: return $l10n->translate($tex t);

    What am I doing wrong?

    Thanks!
  • lowbotpro
    New Member
    • Oct 2006
    • 2

    #2
    Any help? Please?

    Comment

    • ronverdonk
      Recognized Expert Specialist
      • Jul 2006
      • 4259

      #3
      I really have no idea, but at least you can trace some things.You can issue [php]echo $I10n.'<br>';[/php] statements right after the $l10n = new gettext ... stmt, and inside the function. At least you can see if both echoes return an object reference and have the same Object #xxx text content. If not, you must look further.

      Ronald :cool:

      Comment

      Working...