[Mediawiki-l] undefined variable
Platonides
Platonides at gmail.com
Sat Jun 27 23:12:15 UTC 2009
Andreas Meyer wrote:
> 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
Change $parser-> with $wgParser->
Although the way it uses is not a very good one.
More information about the MediaWiki-l
mailing list