Hello
I'm trying to add a link in the footer by adding the example in [1] to my LocalSettings.php. Unfortunately it doesn't work and I have no clue how to work with the information given in [1] nor in the error messages.
The errors are: PHP Parse error: syntax error, unexpected 'public' (T_PUBLIC), expecting end of file in /etc/mediawiki/LocalSettings.php on line 186 PHP Fatal error: Uncaught Error: Class 'WebRequest' not found in /usr/share/mediawiki/includes/HeaderCallback.php:63\nStack trace:\n#0 [internal function]: MediaWiki\HeaderCallback::callback()\n#1 {main}\n thrown in /usr/share/mediawiki/includes/HeaderCallback.php on line 63
I'm very new to Mediawiki and the information in the documentation feels quite overwhelming. Although there is much written in great detail I'm having a hard time putting it into perspective. I don't know what to learn first to make this work.
It would be encouraging if you could give me a tip or two on how to approach this problem. And maybe, if you feel generous, outline the process of adding the example link.
Mediawiki 1.35, Vector
Kind regards Noob
[1] https://www.mediawiki.org/wiki/Manual:Hooks/SkinAddFooterLinks
On Mon, Dec 28, 2020 at 2:31 PM Noob < mediawiki_noob_20201228@ito.in-berlin.de> wrote:
The errors are: PHP Parse error: syntax error, unexpected 'public' (T_PUBLIC), expecting end of file in /etc/mediawiki/LocalSettings.php on line 186
I think "public static function" goes inside classes, and in LocalSettings.php just "function" might work. That gets rid of the error, but I haven't upgraded to 1.35 so can't check whether the code works.
PHP Fatal error: Uncaught Error: Class 'WebRequest' not found in /usr/share/mediawiki/includes/HeaderCallback.php:63\nStack trace:\n#0 [internal function]: MediaWiki\HeaderCallback::callback()\n#1 {main}\n thrown in /usr/share/mediawiki/includes/HeaderCallback.php on line 63
This might disappear when the other error does but the same error appeared here: https://www.mediawiki.org/wiki/Topic:W02ztr7ierd0ff9l
Best wishes
Jonathan
Hello
and thank you, Jonathan, for your suggestion.
To make the example [1] work in LocalSettings.php I had to use the following code:
$wgHooks['SkinAddFooterLinks'][] = function( $skin, $key, &$footerlinks ) { if ( $key === 'places' ) { $footerlinks['test1'] = '<A href=#>Test Link 1</a>'; $footerlinks['test2'] = '<A href=#>Test Link 2</a>'; } };
Kind regards N.
[1] https://www.mediawiki.org/wiki/Manual:Hooks/SkinAddFooterLinks#Example
On 30.12.20 01:18, Jonathan M wrote:
On Mon, Dec 28, 2020 at 2:31 PM Noob < mediawiki_noob_20201228@ito.in-berlin.de> wrote:
The errors are: PHP Parse error: syntax error, unexpected 'public' (T_PUBLIC), expecting end of file in /etc/mediawiki/LocalSettings.php on line 186
I think "public static function" goes inside classes, and in LocalSettings.php just "function" might work. That gets rid of the error, but I haven't upgraded to 1.35 so can't check whether the code works.
PHP Fatal error: Uncaught Error: Class 'WebRequest' not found in /usr/share/mediawiki/includes/HeaderCallback.php:63\nStack trace:\n#0 [internal function]: MediaWiki\HeaderCallback::callback()\n#1 {main}\n thrown in /usr/share/mediawiki/includes/HeaderCallback.php on line 63
This might disappear when the other error does but the same error appeared here: https://www.mediawiki.org/wiki/Topic:W02ztr7ierd0ff9l
Best wishes
Jonathan
MediaWiki-l mailing list To unsubscribe, go to: https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
mediawiki-l@lists.wikimedia.org