টেমপ্লেট:When on basepage

উইকিপিডিয়া, মুক্ত বিশ্বকোষ থেকে
(টেমপ্লেট:Basepage subpage থেকে ঘুরে এসেছে)
নথি আইকন টেমপ্লেট নথি[দেখুন] [সম্পাদনা] [ইতিহাস] [শোধন]

This is the {{When on basepage}} meta-template. It helps other templates detect if they are on a basepage (i.e. a page whose name matches the pattern "x:x") subpage ("x:x/x") or subsubpage ("x:x/x/x").

An alternative way to detect whether a page is a subpage is to combine the parser functions #ifeq: and #titleparts. See Alternatives for simpler text below.

ব্যবহার[সম্পাদনা]

{{When on basepage |result if on a basepage (|result if on a subpage) (|result if on a subsubpage) (|page=pagename)}}

For example, {{When on basepage|Basepage|Subpage}} on the page "User:Example" would return: Basepage
whilst on "User:Example/page" (or "User:Example/page/page", "User:Example/page/page/page", etc) it would return: Subpage

On a subsubpage such as "User:Example/page/page" (or "User:Example/page/page/page", etc), {{When on basepage|Basepage|Subpage|Subsubpage}} would return: Subsubpage

Use an empty parameter to specify no action for a particular type of page. {{When on basepage|Basepage||Subsubpage}} on "User:Example/page", for example, would return nothing, but would return "Subsubpage" if on "User:Example/page/page", "User:Example/page/page/page", etc (and "Basepage" if on "User:Example").

হ্যান্ডলিং চিহ্ন-সমান ("=")[সম্পাদনা]

Use numbered parameters if their values include equals-signs ("="), i.e.

{{When on basepage |1=basepage result (|2=subpage result) (|3=subsubpage result)}}

পৃষ্ঠা প্যারামিটার[সম্পাদনা]

The page parameter is included for testing/demonstration. For example:

{{When on basepage |(basepage result)|(subpage result)|page=User:Example/test}}

Regardless of where the above is placed, it will return: (subpage result)
(because "User:Example/test" is a subpage). The page doesn't have to exist.

If page is left empty (|page=) or undefined, the page where the template is transcluded (i.e.
purge rev-ID : 1708484   b: c: m: n: q: s: t: w: wikt: ?version all messages
$wgMagicWordsEn at CVS Language.php mail / m:help:Variable, m:Global variables
method a method b generates
common namespaces [-2 - 15] / used at all MediaWiki projects
{{ns:-2}} {{ns:Media}}  মিডিয়া
{{ns:-1}} {{ns:Special}}  বিশেষ
(Main) – MediaWiki:Blanknamespace – ‎(প্রধান)
{{ns:1}} {{ns:Talk}}  আলাপ
{{ns:2}} {{ns:User}}  ব্যবহারকারী
{{ns:3}} {{ns:User_talk}}  ব্যবহারকারী আলাপ
{{ns:4}} {{ns:Project}}  উইকিপিডিয়া
{{ns:5}} {{ns:Project_talk}}  উইকিপিডিয়া আলোচনা
{{ns:6}} {{ns:Image}}  চিত্র
{{ns:7}} {{ns:Image_talk}}  চিত্র আলোচনা
{{ns:8}} {{ns:MediaWiki}}  মিডিয়াউইকি
{{ns:9}} {{ns:MediaWiki_talk}}  মিডিয়াউইকি আলোচনা
{{ns:10}} {{ns:Template}}  টেমপ্লেট
{{ns:11}} {{ns:Template_talk}}  টেমপ্লেট আলোচনা
{{ns:12}} {{ns:Help}}  সাহায্য
{{ns:13}} {{ns:Help_talk}}  সাহায্য আলোচনা
{{ns:14}} {{ns:Category}}  বিষয়শ্রেণী
{{ns:15}} {{ns:Category_talk}}  বিষয়শ্রেণী আলোচনা
reserved namespaces
{{ns:16}}    
{{ns:17}}    
{{ns:98}}    
{{ns:99}}    
custom namespaces
{{ns:100}}    প্রবেশদ্বার
{{ns:101}}    প্রবেশদ্বার আলোচনা
{{ns:102}}    
{{ns:103}}    
{{ns:104}}    
{{ns:105}}    
{{ns:106}}    
{{ns:107}}    
{{ns:121}}    
{{ns:122}}    
{{ns:127}}    
{{ns:128}}    
{{ns:2147483646}}    
{{ns:2147483647}}    
variables
{{CURRENTDAY}}  ২০
{{CURRENTDAY2}}  ২০
{{CURRENTDAYNAME}}  শনিবার
{{CURRENTDOW}}  ৬
{{CURRENTMONTH}}  ১২
{{CURRENTMONTHABBREV}}  ডিসে
{{CURRENTMONTHNAME}}  ডিসেম্বর
{{CURRENTMONTHNAMEGEN}}  ডিসেম্বর
{{CURRENTTIME}}  ০৫:৫৩
{{CURRENTWEEK}}  ৫১
{{CURRENTYEAR}}  ২০১৪
{{FULLPAGENAME}}  টেমপ্লেট:When on basepage
{{FULLPAGENAMEE}}  %E0%A6%9F%E0%A7%87%E0%A6%AE%E0%A6%AA%E0%A7%8D%E0%A6%B2%E0%A7%87%E0%A6%9F:When_on_basepage 1
{{NAMESPACE}}  টেমপ্লেট
{{NAMESPACEE}}  %E0%A6%9F%E0%A7%87%E0%A6%AE%E0%A6%AA%E0%A7%8D%E0%A6%B2%E0%A7%87%E0%A6%9F 1
{{NUMBEROFARTICLES}}  ৩৩,৪০০
{{NUMBEROFFILES}}  ২,৮৬০
{{PAGENAME}}  When on basepage
{{PAGENAMEE}}  When_on_basepage 1
{{SCRIPTPATH}}  /w 1
{{SERVER}}  //bn.wikipedia.org
{{SERVERNAME}}  bn.wikipedia.org
{{SITENAME}}  উইকিপিডিয়া
predefined templates
{{FULLURL:}}  
{{FULLURLE:}}  
{{GRAMMAR:}}  GRAMMAR CVS /languages/
{{INT:}}  
{{LC:}}  
{{LCFIRST:}}  
{{LOCALURL:}}  
{{LOCALURLE:}}  
{{MSG:}}  
{{MSGNW:}}  
{{NS:}}  
{{PLURAL:}}  
{{RAW:}}  
{{REVISIONID:}}  
{{REVISIONID}}  1708484
{{SUBST:}}  
{{UC:}}  
{{UCFIRST:}}  
1 this documentation displays this value LTR (left to right)
 | common reserved custom namespacesvariablespredefined templates
) is used.

page also accepts variables, e.g. {{When on basepage|(basepage result)|(subpage result)|page={{{page|}}} }}

প্রযুক্তিগত নোট[সম্পাদনা]

This template detects subpages in all namespaces, including those without the MediaWiki subpage feature enabled.

সহজ টেক্সট জন্য বিকল্প[সম্পাদনা]

A subpage can be detected without using another template, by instead using the title-splitting parser function #titleparts with #ifeq:

{{#ifeq:{{#titleparts:{{PAGENAME}}|1|1}}|{{PAGENAME}}
 | [...code if on a basepage...]
 | [...code if on a subpage...]
}}

For example, many templates can check if the page is a /sandbox version, by the similar markup with #ifeq and #titleparts:

{{#ifeq: {{#titleparts:{{PAGENAME}}|1|1}} | {{PAGENAME}}
| {{documentation}}
| {{template sandbox notice}}
}}

That simple logic works because Template:Template_sandbox_notice also checks the page name for "/sandbox" before displaying the sandbox notice; otherwise, any other subpage would show no extra text. By avoiding a template, and using a single #ifeq, then the processing uses only +2 expansion depth levels, rather than +7 levels, and avoids "wp:exceeded template limits" inside a complex /doc page.

আরও দেখুন[সম্পাদনা]

টেমপ্লেট:Namespace and pagename-detecting templates