Topic on Extension talk:MobileFrontend

Adding HTML after content?

5
Summary by Jdlrobson

If you need to update the HTML of the Minerva skin you can edit the minerva.mustache file to add markup.

Yellowdog (talkcontribs)

I use MW 1.27.1 combined with MobileFrontend 1.0.0 and in LocalSettings I have a hook to add some content on all pages of a wiki:

$wgHooks['SkinAfterContent'][] = function ( &$data, Skin $skin ) {

$data .= 'Some html footer after the content....';

};

However, this does not show in Minerva's "Mobile view" skin. Where and how may I add HTML to also show at the end of all MW pages in Mobile view?

DSquirrelGM (talkcontribs)

You might need to add an id containing the prefix "mf-" to the part to be displayed (or whatever the wiki is set to key on to display it on mobile view).

Yellowdog (talkcontribs)

Thanks for the tip. However, I'm not quite sure how and where the changes should be made. Is there anyone who can provide more specific details how and where to set the key or id with prefix?

Yellowdog (talkcontribs)

Instead of adding some html in LocalSettings to apply in Mobile view (since I still do not know how this can be done) a workaround is to include the html in the minerva.mustache file, right after <div id="content" class="mw-body">{{{contenthtml}}} for it to appear at the end of any content page.

This works fine with the exception that I have several wikis using the same MobileFrontend extension, while the code should ideally only be apply to one of the wikis.

Is there a way to include conditional output in minerva.mustache depending on which wiki is used?

In a regular php program, I could add something like follows:

if ($_SERVER["SERVER_NAME"] == "www.example.com") {

helloworld!

?>

But this isn't possible from within the minerva.mustache template file as far as I know.

Does anyone have a better idea?

Yellowdog (talkcontribs)

I found where it's better done: MobileFrontend.skin.hooks.php