[Mediawiki-l] undefined variable

Andreas Meyer anmeyer at anup.de
Sat Jun 27 09:22:18 UTC 2009


Hello!

I installed AddMetas.php and get this in the error-logfile of Apache:

Undefined variable: parser in /vwww/insilence/root/extensions/AddMetas.php on line 25
Trying to get property of non-object in /vwww/insilence/root/extensions/AddMetas.php on line 25


The function in AddMetas.php looks like this:

function wfAddMetas( &$out, &$text ) {
  global $wgTitle, $wgParser, $wgRequest, $action;
  if(
          $action !== 'edit'
       && $action !== 'history'
       && $action !== 'delete'
       && $action !== 'watch'
       && strpos( $parser->mTitle->mPrefixedText, 'Special:' ) === false
       && $parser->mTitle->mNamespace !== 8
  )
  {
    $name = $wgTitle->getPrefixedDBKey();

    $out->addMeta( 'Description', 'you meta description');
    $out->addMeta( 'Keywords', $name.', your meta keywords' );
    //$out->addMeta( 'Author', 'the author');
    //$out->addMeta( 'Rating', 'General');
    //$out->addMeta( 'Revisit', '1 DAYS');
    //$out->addMeta( "revisit-after", "5 days");
  }
  return true;
}

I am not a PHP-specialist. What is wrong?

Regards
-- 
   Andreas Meyer

A man, a miss, a car -- a curve,
He kissed the miss and missed the curve

Mein öffentlicher GPG-Schlüssel unter:
http://gpg-keyserver.de/pks/lookup?search=anmeyer&fingerprint=on&op=index



More information about the MediaWiki-l mailing list