Template:Editnotice load: Difference between revisions

From PsiForum
Jump to navigation Jump to search
(Created page with '<templatestyles src="Wikipedia:Main Page/styles.css" /> <div id="mp-topbanner" class="mp-bordered"> <div id="mp-welcomecount"> <div id="mp-welcome"><h1>Welcome to Wikipedia</h1>,</div> <div id="mp-free">the free encyclopedia that anyone can edit.</div> <div id="articlecount">{{NUMBEROFARTICLES}} articles in English</div> </div> <ul id="mp-portals"> <li>...')
 
 
Line 1: Line 1:
<templatestyles src="Wikipedia:Main Page/styles.css" />
+
{{#if: {{Editnotice load/content
<div id="mp-topbanner" class="mp-bordered">
+
| notice action = {{{notice action|}}}
<div id="mp-welcomecount">
+
}} | <!--
<div id="mp-welcome"><h1>Welcome to [[Wikipedia]]</h1>,</div>
+
We unfortunately have to call /content twice so that the editnotice-area and clear elements
<div id="mp-free">the [[free content|free]] [[encyclopedia]] that [[Help:Introduction to Wikipedia|anyone can edit]].</div>
+
are only output if there is at least one actual edit notice. This ensures the software can determine
<div id="articlecount">[[Special:Statistics|{{NUMBEROFARTICLES}}]] articles in [[English language|English]]</div>
+
whether or not a page has edit notices (for the API, WikiEditor, VisualEditor and others). And to ensure
</div>
+
MediaWiki:Editnotice-notext gets shown when appropiate.
<ul id="mp-portals">
+
--><div id="editnotice-area" class="nomobile editnotice-area mw-parser-output" style="clear: both; width: 100%;">{{Editnotice load/content
<li>[[Portal:The arts|The arts]]</li>
+
| notice action = {{{notice action|}}}
<li class="portal-vmid">[[Portal:Biography|Biography]]</li>
+
}}<div style="clear: both;"></div></div>
<li class="portal-vbot">[[Portal:Geography|Geography]]</li>
+
}}<noinclude>
<li class="portal-hmid">[[Portal:History|History]]</li>
+
 
<li class="portal-hmid portal-vmid">[[Portal:Mathematics|Mathematics]]</li>
+
{{documentation}}
<li class="portal-hmid portal-vbot">[[Portal:Science|Science]]</li>
+
<!-- Add categories and interwikis to the /doc subpage, not here! -->
<li class="portal-hright">[[Portal:Society|Society]]</li>
+
</noinclude>
<li class="portal-hright portal-vmid">[[Portal:Technology|Technology]]</li>
 
<li class="portal-hright portal-vbot">[[Wikipedia:Contents/Portals|All portals]]</li>
 
</ul>
 
</div>
 
{{#if:{{Main Page banner}}|
 
<div id="mp-banner" class="MainPageBG mp-bordered">
 
{{Main Page banner}}
 
</div>
 
}}
 
{| role="presentation" id="mp-upper"
 
| id="mp-left" class="MainPageBG mp-bordered" |
 
<h2 id="mp-tfa-h2" class="mp-h2">{{#ifexpr:{{formatnum:{{PAGESIZE:Wikipedia:Today's featured article/{{#time:F j, Y}}}}|R}}>150|From today's featured article|Featured article <span class="mp-later">(Check back later for today's.)</span>}}</h2>
 
<div id="mp-tfa">{{#ifexpr:{{formatnum:{{PAGESIZE:Wikipedia:Today's featured article/{{#time:F j, Y}}}}|R}}>150|{{Wikipedia:Today's featured article/{{#time:F j, Y}}}}|{{Wikipedia:Today's featured article/{{#time:F j, Y|-1 day}}}}}}</div>
 
<h2 id="mp-dyk-h2" class="mp-h2">Did you know&nbsp;...</h2>
 
<div id="mp-dyk">{{Did you know}}</div>
 
| class="mp-bordered mid-table" |
 
| id="mp-right" class="MainPageBG mp-bordered" |
 
<h2 id="mp-itn-h2" class="mp-h2">In the news</h2>
 
<div id="mp-itn">{{In the news}}</div>
 
<h2 id="mp-otd-h2" class="mp-h2">On this day</h2>
 
<div id="mp-otd">{{Wikipedia:Selected anniversaries/{{#time:F j}}}}</div>
 
|}
 
<!-- IF MONDAY OR FRIDAY, SHOW TFL -->{{#switch:{{CURRENTDAYNAME}}|Monday|Friday=
 
<div id="mp-middle" class="MainPageBG mp-bordered">
 
<div id="mp-center">
 
<h2 id="mp-tfl-h2" class="mp-h2">From today's featured list</h2>
 
<div id="mp-tfl">{{#ifexist:Wikipedia:Today's featured list/{{#time:F j, Y}}|{{Wikipedia:Today's featured list/{{#time:F j, Y}}}}|{{TFLempty}}}}</div>
 
</div>
 
</div>|}}<!-- END CONDITIONAL SHOW -->
 
<div id="mp-lower" class="MainPageBG mp-bordered">
 
<div id="mp-bottom">
 
<h2 id="mp-tfp-h2" class="mp-h2">{{#ifexist:Template:POTD protected/{{#time:Y-m-d}}|Today's featured picture|Featured picture&ensp;<span class="mp-later">(Check back later for today's.)</span>}}</h2>
 
<div id="mp-tfp">{{#ifexist:Template:POTD protected/{{#time:Y-m-d}}|{{POTD protected/{{#time:Y-m-d}}}}|{{POTD protected/{{#time:Y-m-d|-1 day}}}}}}</div>
 
</div>
 
</div>
 
<div id="mp-other-lower" class="mp-bordered">
 
<h2 id="mp-other" class="mp-h2">Other areas of Wikipedia</h2>
 
<div id="mp-other-content">{{Other areas of Wikipedia}}</div>
 
<h2 id="mp-sister" class="mp-h2">Wikipedia's sister projects</h2>
 
<div id="mp-sister-content">{{Wikipedia's sister projects}}</div>
 
<h2 id="mp-lang" class="mp-h2">Wikipedia languages</h2>
 
<div>{{Wikipedia languages}}</div>
 
</div><noinclude>{{Main Page interwikis}}{{noexternallanglinks}}{{#if:{{Wikipedia:Main_Page/Tomorrow}}||}}</noinclude>__NOTOC____NOEDITSECTION__
 

Latest revision as of 04:37, 4 February 2022


Template documentation[view] [edit] [history] [purge]

This is the {{editnotice load}} template.

This template is normally only used by the system, it is the editnotice loader used in MediaWiki. It displays the editnotices and the links to them, at the top of pages when editing pages.

Technical details

This template loads and displays the namespace notice. It also calls the sub-template {{editnotice load/core}}. That sub-template handles the loading of the group and page notices, and the links to them. While this template does parameter preprocessing, thus simplifying the code.

This template is placed in the main MediaWiki namespace notices named MediaWiki:Editnotice-0, MediaWiki:Editnotice-1 and so on. See Wikipedia:Namespace for the full list of namespace numbers. Then this template needs no parameter.

The links

When a page is edited this template often displays red or blue links at the top of the edit page looking like this:

Or like this:

Those links are to the group and page editnotices of the page. Admins, page movers and template editors always see both links, even if the notices have not yet been created, since they can create and edit the editnotices. Normal users only see the red "Page notice" link on their own user and user talk basepage, since they can create and edit such notices. Normal users also see blue links to group and page notices if they already have been created, so they can find and view the source code of the notice. But normal users still can't edit those notices, except the ones in userspace.

View source or edit

The editnotices are also displayed when a user "views the source" of a protected page. (When a non-admin tries to edit a fully protected page, or when an IP-user tries to edit a semi or fully protected page.) The group and page notices are displayed, but not the namespace notices.

Most editnotices have useful information even when just viewing the source of a protected page, but in some cases we want to display different information to users who are just viewing the source of the page. This template feeds "notice action = view" to the editnotices it loads when in view mode. This can be used inside the editnotices like this:

{{#ifeq: {{{notice action|}}} | view
| <!--A non-admin is "viewing the source" of a protected page-->
| <!--A user with sufficient rights is editing the page-->
}}

TemplateData

This is the TemplateData for this template used by TemplateWizard, VisualEditor and other tools. Click here to see a monthly parameter usage report for this template based on this TemplateData.

TemplateData for Editnotice load

The editnotice loader used in the “MediaWiki:Editnotice-*” messages.
ParameterDescriptionTypeStatus
Notice Actionnotice action
Set to “view” when the current page is protected and the current user doesn’t have the required permissions to edit the page.
Example
view
Linesuggested
Test of raw TemplateData output:

The editnotice loader used in the “MediaWiki:Editnotice-*” messages.

Template parameters

ParameterDescriptionTypeStatus
Notice Actionnotice action

Set to “view” when the current page is protected and the current user doesn’t have the required permissions to edit the page.

Example
view
Linesuggested

See also