Jump to content

Manual talk:Footer

Add topic
From mediawiki.org
[edit]

Hi!
I'd like to add a completely different text in the footer, something like "i love u" (along with "disclaimer", "lastmod").
I looked here: "Footer" and I found out how to change "$wgRightsText", but it's not what I'm looking for (it displays "Content is available under" before the text).
I've tried this way too, but it doesn't work either:
$footerlinks = array( 'info' => array( 'i love u', "i love u", 'numberofwatchingusers', 'copyright', ), );
I'd like to simply add some more text to this footer...seems easy, but I may have my blond moment...
Thanks! ps: Im running MW 1.16...

Bump. I'd also love to do this, but using MW1.26
[edit]

Add the following to LocalSettings.php:

$wgHooks['SkinAddFooterLinks'][] = function ( Skin $skin, string $key, array &$footerlinks ) {
        if ( $key === 'places' ) {
           $footerlinks['your-choice-of-name'] = Html::rawElement( 'div', [], $skin->msg( 'your-choice-of-name' ) );
    };
};

Then you can edit MediaWiki:your-choice-of-name with plain text, or the wikitext that you prefer.

[edit]

Using MW1.6.8 and when viewed through IE7 the footer links are all shown in one long line. Wikipedia doesnt have this problem. I thought I would disable the poweredby icon but I'm not sure how. Any suggestions?

I disabled the nowrap line inside main.css and it now folds nicely. Look for the comment 'hide from incapable browsers' and comment the next line out.
(See First question below. --Thnidu 23:07, 5 February 2010 (UTC))Reply

More generic solution?

[edit]

The manual mentions: "For example if you go in to MonoBook.php you will find the following code" and "this must be done for each template". Both statements are true, but the code in the various skins are not identical. I'm not familiar with php, so what I could find is the '$footerlinks' solution in Monobook and something to do with 'bottomLinks' in CologneBlue, Nostalgia and 'Standard'. However, I'm not sure how to modify this code, and I have no idea how other skins work. It would be nice if someone could describe this topic in more detail.

Ultimately my goal would be to add something to the footer for all skins. I definitely want to enable the copyright statement (which I can probably do in LocalSettings, I'll look it up), but it would also be nice to add some plain text, e.g. like Wikipedia has ("Wikipedia® is a registered trademark...").

Where?

[edit]

$footerlinks = array(

       'lastmod', 'viewcount', 'numberofwatchingusers', 'credits', 'copyright',
       'privacy', 'about', 'disclaimer', 'tagline',

);


Where is this? I can't find it in Monobook.php.Dagoth Ur, Mad God 01:10, 26 July 2008 (UTC)Reply

For one thing, it's MonoBook.php and it's in there. - JCM

Not present in monobook.php ver. 1.18.1 - BW

Javascript?

[edit]

HOW can I do the same in Monobook.js ??????? 89.12.9.51 01:36, 30 January 2011 (UTC)Reply

External links?

[edit]

I'd like to set up an external disclaimers-page. Can I set the URL as it is in *:Disclaimerpage? And (sorry I'm new in MediaWiki) what's up with other languages (im my case: german) is the name of those "setting-pages" translated? And if it is... how can I find it? Where is the name defined? -- Deus Figendi

What's credits?

[edit]

"credits" is in the php code line, but what is it? No manual page, and a search for "credits" gives 120 hits, the first 20 of which are irrelevant: e.g.,

  • The Contribution Credits extension adds...
  • Also, be sure to include a credits block in...

--Thnidu 22:53, 5 February 2010 (UTC)Reply

It seems to be related to Manual:$wgMaxCredits --Frantik 23:26, 15 May 2010 (UTC)Reply

First question

[edit]

The first question on this page didn't have a level-2 header, so the answer to it -- which did -- came after the TOC. I rearranged it -- hope this is OK. --Thnidu 23:07, 5 February 2010 (UTC)Reply

Add image to footer?

[edit]

Hi all,

I run MW1.16 and I've tried to add a normal image to my footer, but I don't get how to. This following code (in Vector.php) is wrong, but does someone know why?

$footerlinks = array([[File:MyImage.jpg]], 'info' => array('lastmod', 'copyright',),'places' => array('disclaimer',),);

and could I fix it? Thx a lot!

This array is not the same in 1.17.0

[edit]

It would be nice if these instructions could be updated for 1.17.0. Still can't figure out where the array is to add a link to the footer. Went to MonoBook.php, but the footer text looks different now.

Bad information for 1.17

[edit]

This recommendation in a mw.org manual here to modify the core code in SkinTemplate is absolutely horrible. That footerlinks array was added because it meant you could use the existing SkinTemplateOutputPageBeforeExec hook to modify the array without modifying any core code or skin code. Suggesting to modify core code that was added to make editing skin code unnecessary is ridiculously counter-productive. Dantman 20:58, 1 September 2011 (UTC)Reply

cant you put it back to how it was before? — Preceding unsigned comment added by 146.227.1.15 (talkcontribs) 11:46, 21 October 2011
You wan't me to undo instructions on how to properly add footerlinks and replace it with the suggestion to modify core code? Can you give me a valid reason for that? 96.48.217.226 19:27, 21 October 2011 (UTC)Reply
I mean revert the code back to the old way to change the footer so I dont need to add a load of code to my local settings or having to edit skin files just to be able to remove a link. 146.227.1.15 15:52, 7 November 2011 (UTC)Reply
Its really hard to customize a footer atm if you are not a programmer. Could anyone make better instructions how to do it? — Preceding unsigned comment added by 91.79.179.112 (talkcontribs) 19:10, 13 March 2013‎
Unfortunately that's just the situation right now. There was to much legacy coded into the skin templates to make footer links friendly to modify. Making footer links friendly to use will require a more involved and disruptive change in the future. Daniel Friesen (Dantman) (talk) 00:09, 14 March 2013 (UTC)Reply
Thank you very much for a reply. So this feature would not be available in nearby future?
Not sure about near future. It's a non trivial code change and I don't have the time to work on it. Daniel Friesen (Dantman) (talk) 17:54, 16 March 2013 (UTC)Reply

restored some information

[edit]

the new instructions were too technical and hard to understand. The new removed/minimized how to change the footer before 1.16.

So I merged and added back much of those edits here: [1]

Igottheconch 22:39, 13 January 2012 (UTC)Reply

Colors

[edit]

Is there a simple way to change border colors for the footer in MW 1.18? --89.139.191.243 12:29, 9 March 2012 (UTC)Reply

I guess you are talking about the MonoBook skin. Adding this to "MediaWiki:Monobook.css" will e.g. change them to orange:
div#footer {
  border-bottom: 1px solid #ffa500;
  border-top: 1px solid #ffa500;
}
Just change the hex (#......) to the colour you like. --[[kgh]] (talk) 20:45, 23 June 2014 (UTC)Reply
[edit]

The instruction is for adding a link. Alright! But How do I remove the disclaimer link in the footer?

Just remove the word "Disclaimer" from system message "MediaWiki:Disclaimers" (as the sysop user). To delete the system message will however not work. --[[kgh]] (talk) 20:35, 23 June 2014 (UTC)Reply
This works, but is there a hook with which one can remove footer link (like disclaimer, privacy policy) without making changes to the default skin's file?
You do not have to do this. Just remove the text form the respective system messages on the wiki itself. --[[kgh]] (talk) 14:03, 5 May 2017 (UTC)Reply
[edit]

What do you put on MediaWiki:Termsofservice page to do that?

The name is of the system message is "MediaWiki:Termsofservicepage" (no blank) and you just add the title of the page the link should point to to this page. If this page is not in the main namespace you just prepend the namespace prefix like e.e. Project:Terms_of_Service. --[[kgh]] (talk) 13:03, 5 May 2017 (UTC)Reply
[edit]

Is there a way of adding more than 1 extra link to the footer? How would this code need to get changed? Simply copying this blanks the wiki.

$wgHooks['SkinTemplateOutputPageBeforeExec'][] = 'lfTOSLink';
function lfTOSLink( $sk, &$tpl ) {
	$tpl->set( 'termsofservice', $sk->footerLink( 'termsofservice', 'termsofservicepage' ) );
	$tpl->data['footerlinks']['places'][] = 'termsofservice';
	return true;
}

Correct subsitution of "termsofservice" and "termsofservicepage" goes without saying. --Zabien (talk) 20:00, 10 June 2015 (UTC)Reply

A bit late to answer but perhaps this helps other. Just add the hook twice or more times into you "LocalSettings.php" file. Cheers --[[kgh]] (talk) 12:58, 5 May 2017 (UTC)Reply
[edit]

Another small question: How can I get the new, extra added footer links (via the code with SkinTemplateOutputPageBeforeExec to show up under Special:AllMessages? Or is there a reason for why they shouldn't? --Zabien (talk) 20:09, 10 June 2015 (UTC)Reply

Good question. I cannot tell. However it shows up on "Special:PrefixIndex" which should be good enough to find them once content to the custom system messages was added. --[[kgh]] (talk) 13:05, 5 May 2017 (UTC)Reply
[edit]

@Reedy: This change is fine with me, however this causes parsing errors like e.g. Parse error: syntax error, unexpected '$wgHooks' (T_VARIABLE) in ... for the second footer link I would like to add. So how do I add more than one extra footer link? Cheers --[[kgh]] (talk) 20:56, 23 October 2017 (UTC)Reply

Never mind. I found the error. Forgot to add the trailing semicolon. One of these days ... :| --[[kgh]] (talk) 20:58, 23 October 2017 (UTC)Reply
[edit]

Is it possible to link to a special page? I've tried different variations similar to the code below but can't get it to work.


$wgHooks['SkinAddFooterLinks'][] = function ( Skin $skin, string $key, array &$footerlinks ) {

  if ( $key === 'places' ) {

     $footerlinks['version'] = $skin->footerLink( 'Version', 'special:version' );

  };

}; Tombpl (talk) 11:53, 16 March 2022 (UTC)Reply

Added config but not working

[edit]

I added the config to my LocalSettings file, but the link doesn't appear in the footer. I tracked it down to includes/skins/BaseTemplate.php in getFooterLinks, where it doesn't consider the link to be "valid" (i.e. having a value in $this->data[$link]).

Any ideas what I've missed?

76.102.130.155 07:57, 30 January 2023 (UTC)Reply

How do you add it? Post the code here. Ammarpad (talk) 19:41, 1 February 2023 (UTC)Reply
Thanks for the reply. I followed the instructions over on the Manual side of this page, by adding a block to my LocalSettings file:
$wgHooks['SkinAddFooterLinks'][] = function ( Skin $skin, string $key, array &$footerlinks ) {
if ( $key === 'places' ) {
$footerlinks['test'] = $skin->footerLink( 'Page Pretty Name', 'Page_Title' );
};
};
where "Page_Title" is something that works when you put it in a URL after "/index.php?title=".
Nothing is added to the footer, even if you view source. 76.102.130.155 00:50, 2 February 2023 (UTC)Reply
To avoid confusion, when reporting issues please state the version of mediawiki you're using.
Skin::footerLink is deprecated in MW 1.40, but that's less an issue since it still works.
It seems your page is at "/index.php?title=Page_Title" (whatever name it has) and 'Page Pretty Name' is what you want be displayed (the literal string). I think that's where the problem is. These values are i18n messages (not literal strings), so they must live in MediaWiki: namespace. You should create a page like "MediaWiki:Page_Title" and then use the hook with "Page_Title" (without the namespace). Ammarpad (talk) 12:03, 2 February 2023 (UTC)Reply
Sorry, still confused (and appreciateive). The other links in the footer (Privacy policy, About SITE, Disclaimers) go to pages that start with the wgMetaNamespace (e.g. "Project:Privacy_policy"). Is it such that I cannot link to another page in that namespace (that it must be in MediaWiki as you show)? 76.102.130.155 00:08, 3 February 2023 (UTC)Reply
The other links in the footer (Privacy policy, About SITE, Disclaimers) go to pages that start with the wgMetaNamespace (e.g. "Project:Privacy_policy").
No, they do not go there. That's where your assumption is wrong.

They link to places predefined in MediaWiki: namespace. For instance, on this site, the literal "Privacy policy" you see in the footer is defined at MediaWiki:Privacy. (Note the content, not the title of the page). It's not like "Privacy policy" string is directly passed as parameter, like you're trying to do.

Then the actual page where the "Privacy policy" links to (where it goes to when you click on it), is defined at MediaWiki:privacypage (again, pay attention to the page content, not the page title).

Is it such that I cannot link to another page in that namespace (that it must be in MediaWiki as you show)?
You can link to anywhere, but you have to define the link and link title in mediawiki: namespace. You can't pass it directly to $skin::footerLink, because that method works with i18n message keys not literal strings.

So as already said above, if you want the display title of your footer link to be "My Footer Link"; you should create "MediaWiki:mycustomlinktitle" for example, and put "My Footer Link"; as its content. Then pass "mycustomlinktitle" to the Skin::footerlink method. That's for the display title only. You then repeat the procedure for the link (i.e where "My Footer Link" should go to when clicked). Ammarpad (talk) 07:42, 3 February 2023 (UTC)Reply

Aha! Thank you for using smaller words. It seems that things are working now, which I hope is not just a bad alignment of the planets. Using even smaller words, here's what I understand:
  • "MediaWiki:Privacy" contains the string "Privacy policy" which is shown in the footer.
  • "MediaWiki:Privacypage" contains the page title that clicking the footer link should take you to. In my case, it was "Project:Privacy policy".
  • "Project:Privacy_policy" (the encoded version of the contents of Privacypage, above) then contains the actual text that is displayed on the page.
So, to add your new item to the footer, you need to mirror this process:
  • Create MediaWiki:Mylink which should contain the string "My new link", which is shown in the footer.
  • Create MediaWiki:Mylinkpage contains the page name. I used "My link" (by default in the Main namespace).
  • Create the "My link" page (encoded, would be "My_link") that contains the content to be shown.
then, add the code to your LocalSettings.php file:
$wgHooks['SkinAddFooterLinks'][] = function ( Skin $skin, string $key, array &$footerlinks ) {
    if ( $key === 'places' ) {
# 'mylinkname' can be anything that doesn't conflict with the hardcoded built-in ones, e.g. 'disclaimer', 'privacy', etc).
        $footerlinks['mylinkname'] = $skin->footerLink( 'Mylink', 'Mylinkpage' );
    };
}; 76.102.130.155 10:00, 4 February 2023 (UTC)Reply
[edit]

Footerlink has been depreciated, unsure of alternative for Localsettings.php -- Skunark (talk) 02:01, 13 September 2023 (UTC)Reply

@Jdlrobson: I am sure you can help out for MW 1.40 an later. Much appreciated. -- [[kgh]] (talk) 06:03, 13 September 2023 (UTC)Reply
Could you share the code and skin you are using? Thanks in advance! Jdlrobson (talk) 16:03, 13 September 2023 (UTC)Reply
The code used can be found in 'internal links' section for the localsettings example and works on vector+variants and appeared to work on other skins. Very useful since you didn't have to modify other skins. It might be worth reviewing the entire footer page since all the skins were updated to the new method and I don't believe that's reflected here. --Skunark (talk) 01:17, 14 September 2023 (UTC)Reply
Got it!
Fixed with this edit (hopeful;y?) https://www.mediawiki.org/w/index.php?title=Manual%3AFooter&diff=6107740&oldid=6104422 Jdlrobson (talk) 23:02, 15 September 2023 (UTC)Reply
Thanks a lot! [[kgh]] (talk) 07:28, 16 September 2023 (UTC)Reply
Hello, thank you for updating the code! I noticed that if you have a link like "MyWiki:Terms of Service" in MediaWiki:Termsofservicepage, it doesn't work. The actual link will be <a href="MyWiki:Terms of Service">Terms of Service</a>. Changing MediaWiki:Termsofservicepage to something like "/wiki/MyWiki:Terms_of_Service" will fix that though. Thanks again, cheers and all the best! Till Kraemer (talk) 14:24, 12 December 2023 (UTC)Reply
[edit]

This is not working anymore. It worked in 1.39.1, but it fails to work in 1.41.0.

To remove the privacy, about and/or disclaimer links entirely, replace the link text with a single dash ("-").

How can this be achieved now? Redundant-decadence (talk) 19:11, 26 December 2023 (UTC)Reply

Only workaround I've found is to remove them from $siteLinks in includes/skins/components/SkinComponentFooter.php line 166. Wcthor (talk) 02:19, 6 January 2024 (UTC)Reply