Page MenuHomePhabricator

Requesting hooks for start and end of the sections
Open, LowPublicFeature

Description

Author: filop

Description:
I want to write extension that will show advertisement units called by hooks. Lot of website place ads units in the middle of text, for example just after first paragraph or section, but it is not possible with MediaWiki (or maybe it is?). The hooks should be like Section1Start, Section2End and so on (with section 0 as well).

One of idea of extension with these hooks is to allow to place one of ads units in the middle of article. We're taking number of section, and if there's 4 or more sections, we place ads on the end of ((number of sections / 2) round 0) section.

Hooks shouldn't couse any trouble. Action registred with nonexisting hook and nonexisting section just will not be proceed. That could be even usefull for showing ads depending on text long (I'm also planning to show no ads on too short pages to avoid breaking the Google's TOC and other providers conditions).


Version: unspecified
Severity: enhancement

Details

Reference
bz16624

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 10:26 PM
bzimport added a project: MediaWiki-Parser.
bzimport set Reference to bz16624.
bzimport added a subscriber: Unknown Object (MLST).

karun.84 wrote:

Do you have any examples of what you want to do? I dont know if too many people use Mediawiki with advertisements. The Wikipedia project certainly doesnt.
This is likely not too easy.

You can sort of already do this in a limited way with the DoEditSectionLink hook (However any inserted html would be in the <h2> and it wouldn't work for any pages with NOSECTIONEDIT on, and determining which section number you're at might be difficult if some of the sections are transcluded), or the ParserBeforeStrip hook (To look for sections, and add an extension tag or something in the appropriate place). Neither of those hooks would be ideal though for what you are trying to do.

Aklapper changed the subtype of this task from "Task" to "Feature Request".Feb 4 2022, 11:01 AM
Aklapper removed a subscriber: wikibugs-l-list.