Topic on Project:Support desk

[RESOLVED] Mediawiki Main Page

5
Anyhowputx (talkcontribs)

Hi folks,

Currently, I have a like icon which display on every page. But right now I would like it to display on all other pages except the main page

My code to display the like icon is here (https://dpaste.de/ENfm)

On line 470 is where I check if it is a main page, but I am having issue. It is giving me the error (PHP Fatal error: Using $this when not in object context)

On line 32 is where the method is being declared.

How should I check if it is a main page. Using parser? Using outputToHTML?

Please advise. Greatly appreciated! Thanks all!

FriedhelmW (talkcontribs)

It might be easier to hide the icon using CSS.

2401:7400:C800:32AC:40D2:21B0:DDC9:B4 (talkcontribs)

Hello,

Appreciate your response.

May I know what is the CSS for MainPage? Is it common.css?? :/

Thanks !!!

Ciencia Al Poder (talkcontribs)

the main page doesn't have a special css page. But you can target CSS selectors to particular pages, since the <body> element has specific CSS classes for each page. One is the page title, and the main page has also a special CSS class: mainpage.

You can write something like this:

body.mainpage .like {
 display:none;
}
Reply to "[RESOLVED] Mediawiki Main Page"