Jump to content

Topic on Extension talk:MobileFrontend

MinervaTemplate.php (1.27) no longer accepting ads

13
188.24.66.168 (talkcontribs)

Hello. I have downloaded, through git, the 1.27 branch of MobileFrontend. I used to have an older version (downloaded around May, last year - 1.25). In that older version, placing an ad code, inside MinervaTemplate.php, inside the following lines: protected function renderFooter( $data ) { } and inside if ( $internalBanner || $preBodyText ) { } made ads work on the wiki (top and bottom ads). Things have changed, a bit, in the 1.27 version, thus there are more lines between protected function renderFooter( $data ) { and } and the code has to be placed between return $footer; ?> and <div id="footer"> (bottom ad). For the top ad: between return $data[ 'bodytext' ]; ?> and <div class="pre-content">. Yet the ads won't load, no matter what. Has something changed to the skin that doesn't allow ads anymore. The ad code itself cannot be at fault, as I added the same ad codes (and even more) inside the 1.27 version of MonoBook and Vector. Do the ads have to be added inside another file? Please guide me in the right place.

Bmansurov (WMF) (talkcontribs)

Yes, the footer has changed. If you want to display additional data in the footer, you need to create a div with the `post-content footer-content` classes and insert it after `.last-modified-bar`.

92.83.216.199 (talkcontribs)

Hey. Thanks for the reply. And how about the header?

92.83.216.199 (talkcontribs)

Hey. There is no "last-modified-bar" in the MinervaTemplate.php. I switched to MW 1.28 since then. Was its location changed or do I need to look for something else?

Bmansurov (WMF) (talkcontribs)

As for the header, there is no space in the header for displaying additional content.

The last modified bar HTML has moved to /includes/skins/history.mustache.

Star Warden (talkcontribs)

Thank you for the reply, but I am afraid I can't get it to work. Please bear with me as I describe what I did. I opened that file as you told me to, then, after the last line
<div class="{{^isMainPage}}last-modified-bar{{/isMainPage}} view-border-box post-content">
<div id="mw-mf-last-modified" class="truncated-text">
<a href="{{link}}"
data-user-name="{{username}}"
data-user-gender="{{userGender}}"
data-timestamp="{{timestamp}}">
{{text}}
</a>
</div>
</div>,

I added


<div class="post-content footer-content">

<div class="ad">

then added the code for the add, then closed it with

</div>

</div>

but nothing would display at the bottom (aka the footer). What am I doing wrong?

Jdlrobson (talkcontribs)

It might be caching related. Update the version number in  /includes/skins/minerva.mustache as well and ensure you purge the page.

()=>

Star Warden (talkcontribs)

Nope. I've just redownloaded the entire extension through git (REL 1_28) and even purged the page. Isn't there any other file, aside from history.mustache, that I need to edit? Or maybe I am adding the wrong code?

Jdlrobson (talkcontribs)

did you change the content of minerva.mustache as well?

Star Warden (talkcontribs)

So it seems that ads do appear, but somehow they're awkwardly shown in the middle of the main page, covering a bit of content, that's why I overlooked them, as I always scrolled to the bottom... I've disabled the ads in both mustaches, but they still appear. Is there a way to move them to the bottom rather?

EDIT: Actually, they still appeared because, somehow, putting them between /* */ didn't disable them, for some reason, so I just removed the lines altogether. The ads no longer appear. Still, what you told me does make the code work, but I would like to know if it's possible to send them to the bottom bottom, rather than the middle.

Bmansurov (WMF) (talkcontribs)

Look at style rules that are causing the issue. Your immediate issue seems to be resolved. In the future would you create a task on Phabricator ?

Jdlrobson (talkcontribs)

@Star Warden sounds like you need to add some CSS/HTML. All the HTML markup is in minerva.mustache so please feel free to explore where to place ypur banners to get the desired result.

@Bmansurov (WMF) I'm not sure Phabricator is relevant here as this is about troubleshooting not a bug report.

Star Warden (talkcontribs)

Thank you, I will try that.