<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ar">
	<id>https://ar.wikihaj.com/history/%D9%82%D8%A7%D9%84%D8%A8:Px/%D8%AA%D9%88%D8%B6%D9%8A%D8%AD%D8%A7%D8%AA?feed=atom</id>
	<title>قالب:Px/توضيحات - تاريخ المراجعة</title>
	<link rel="self" type="application/atom+xml" href="https://ar.wikihaj.com/history/%D9%82%D8%A7%D9%84%D8%A8:Px/%D8%AA%D9%88%D8%B6%D9%8A%D8%AD%D8%A7%D8%AA?feed=atom"/>
	<link rel="alternate" type="text/html" href="https://ar.wikihaj.com/history/%D9%82%D8%A7%D9%84%D8%A8:Px/%D8%AA%D9%88%D8%B6%D9%8A%D8%AD%D8%A7%D8%AA"/>
	<updated>2026-08-11T15:24:22Z</updated>
	<subtitle>تاريخ التعديل لهذه الصفحة في الويكي</subtitle>
	<generator>MediaWiki 1.43.0</generator>
	<entry>
		<id>https://ar.wikihaj.com/index.php?title=%D9%82%D8%A7%D9%84%D8%A8:Px/%D8%AA%D9%88%D8%B6%D9%8A%D8%AD%D8%A7%D8%AA&amp;diff=2986&amp;oldid=prev</id>
		<title>Hosainahmadi: أنشأ الصفحة ب&#039;{{زیرصفحه توضیحات}} &lt;!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE --&gt; __NOTOC__ This is the {{tl|px}} template.  This meta-template...&#039;</title>
		<link rel="alternate" type="text/html" href="https://ar.wikihaj.com/index.php?title=%D9%82%D8%A7%D9%84%D8%A8:Px/%D8%AA%D9%88%D8%B6%D9%8A%D8%AD%D8%A7%D8%AA&amp;diff=2986&amp;oldid=prev"/>
		<updated>2021-10-26T08:24:38Z</updated>

		<summary type="html">&lt;p&gt;أنشأ الصفحة ب&amp;#039;{{زیرصفحه توضیحات}} &amp;lt;!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE --&amp;gt; __NOTOC__ This is the {{tl|px}} template.  This meta-template...&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;صفحة جديدة&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{زیرصفحه توضیحات}}&lt;br /&gt;
&amp;lt;!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE --&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This is the {{tl|px}} template.&lt;br /&gt;
&lt;br /&gt;
This meta-template helps other templates, such as infoboxes, to take image size parameters in both of the forms &amp;quot;40&amp;quot; or &amp;quot;40px&amp;quot;. It takes up to three parameters and returns the first one that has any content. That is, the first one that is defined (not null) and not empty. Thus a default value for the width of the image can be fed as the second or third parameter.&lt;br /&gt;
&lt;br /&gt;
=== Usage ===&lt;br /&gt;
&lt;br /&gt;
Here is what this template does. Code to the left, actual rendering to the right:&lt;br /&gt;
&lt;br /&gt;
:{{tlc|px|40}} = {{px|40}}&lt;br /&gt;
:{{tlc|px|40px}} = {{px|40px}}&lt;br /&gt;
&lt;br /&gt;
And with an optional second or even third parameter to be used as a default value if the first or second parameter is empty or undefined:&lt;br /&gt;
&lt;br /&gt;
:{{tlc|px||50}} = {{px||50}}&lt;br /&gt;
:{{tlc|px||50px}} = {{px||50px}}&lt;br /&gt;
&lt;br /&gt;
:{{tlc|px|||60}} = {{px|||60}}&lt;br /&gt;
:{{tlc|px|||60px}} = {{px|||60px}}&lt;br /&gt;
&lt;br /&gt;
And here is how it can be used inside another template:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;[[Image:{{{image}}} | {{px|{{{size|}}}}} | {{{caption|}}} ]]&amp;lt;/nowiki&amp;gt; &amp;lt;/code&amp;gt;&lt;br /&gt;
:&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;[[Image:{{{image}}} | {{px|{{{size|}}}|250}} | {{{caption|}}} ]]&amp;lt;/nowiki&amp;gt; &amp;lt;/code&amp;gt;&lt;br /&gt;
:&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;[[Image:{{{image}}} | {{px| {{{size|}}} | {{{width|}}} | 250 }} | {{{caption|}}} ]]&amp;lt;/nowiki&amp;gt; &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Default values ===&lt;br /&gt;
&lt;br /&gt;
It used to be a bit tricky to handle empty but defined image size values in a template, since the MediaWiki pipetrick doesn&amp;#039;t return the default value for empty parameters. That is, &amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;{{{width|250px}}}&amp;lt;/nowiki&amp;gt; &amp;lt;/code&amp;gt; does not return &amp;quot;250px&amp;quot; if the template was called like this: &amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;{{template|width=}}&amp;lt;/nowiki&amp;gt; &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The usual workaround was to do like this:&lt;br /&gt;
:&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;{{#if:{{{width|}}}|{{{width}}}|250px}}&amp;lt;/nowiki&amp;gt; &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When at the same time handling the &amp;quot;pxpx&amp;quot; bug this became even more messy code:&lt;br /&gt;
:&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;[[Image:{{{image}}} | {{#if:{{{width|}}}|{{px|{{{width}}}}}|250px}} ]]&amp;lt;/nowiki&amp;gt; &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To simplify the coding, {{tl|px}} allows for an optional default value to be defined allowing for the following:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;[[Image:{{{image}}} | {{px|{{{width|}}}|250}} ]]&amp;lt;/nowiki&amp;gt; &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Note!&amp;#039;&amp;#039;&amp;#039; The parameters to {{tlf|px}} must use the pipe &amp;quot;|&amp;quot;, like this: &amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;{{{width|}}}&amp;lt;/nowiki&amp;gt; &amp;lt;/code&amp;gt;. Or else {{tlf|px}} will be fed and return the string &amp;quot;&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;{{{width}}}&amp;lt;/nowiki&amp;gt; &amp;lt;/code&amp;gt;&amp;quot; if &amp;#039;&amp;#039;width&amp;#039;&amp;#039; was not defined.&lt;br /&gt;
&lt;br /&gt;
=== Background ===&lt;br /&gt;
&lt;br /&gt;
Old usage was to always pad on &amp;quot;px&amp;quot; since MediaWiki used to tolerate &amp;quot;40pxpx&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;[[Image:{{{image}}} | {{{size}}}px | {{{caption|}}} ]]&amp;lt;/nowiki&amp;gt; &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
But since [[25 March]] [[۲۰۰۸ (میلادی)|2008]] that does not work anymore. That is, image sizes on Wikihaj now needs to be given in the form &amp;quot;40px&amp;quot;, not &amp;quot;40&amp;quot; or &amp;quot;40pxpx&amp;quot;. This template helps doing that. Note that the bug has since been fixed, although you can continue using this template.&lt;br /&gt;
&lt;br /&gt;
=== See also ===&lt;br /&gt;
&lt;br /&gt;
* [[Wikihaj:ClickFix]] – About the &amp;quot;pxpx&amp;quot; bug.&lt;br /&gt;
* {{tl|ifempty}} – Helps detect empty parameters and fall back to default values. For instance for handling multiple image name parameters.&lt;br /&gt;
&lt;br /&gt;
=== Test examples ===&lt;br /&gt;
&lt;br /&gt;
* {{tlc|px|40}} = {{px|40}}&lt;br /&gt;
* {{tlc|px|40px}} = {{px|40px}}&lt;br /&gt;
* {{tlc|px|40pxpx}} = {{px|40pxpx}}&lt;br /&gt;
* {{tlc|px|junk}} = {{px|junk}}&lt;br /&gt;
* {{tlc|px}} = {{px}}&lt;br /&gt;
* {{tlc|px|}} = {{px|}}&lt;br /&gt;
* {{tlc|px||}} = {{px||}}&lt;br /&gt;
* {{tlc|px|||}} = {{px|||}}&lt;br /&gt;
* {{tlc|px|40|50}} = {{px|40|50}}&lt;br /&gt;
* {{tlc|px||50}} = {{px||50}}&lt;br /&gt;
* {{tlc|px||50px}} = {{px||50px}}&lt;br /&gt;
* {{tlc|px||50|60}} = {{px||50|60}}&lt;br /&gt;
* {{tlc|px|||60}} = {{px|||60}}&lt;br /&gt;
* {{tlc|px|||60px}} = {{px|||60px}}&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;[[Image:Example.png | 50 | thumb ]]&amp;lt;/nowiki&amp;gt; &amp;lt;/code&amp;gt; = [[Image:Example.png| 50 | thumb ]]&lt;br /&gt;
&amp;lt;br clear=all /&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;[[Image:Example.png | 50pxpx | thumb ]]&amp;lt;/nowiki&amp;gt; &amp;lt;/code&amp;gt; = [[Image:Example.png | 50pxpx | thumb ]]&lt;br /&gt;
::Currently fails. But the devs have stated that they are adding back parsing of &amp;quot;pxpx&amp;quot; in the next update to Wikihaj. So if you see a small image to the right then Wikihaj again accepts &amp;quot;pxpx&amp;quot;.&lt;br /&gt;
&amp;lt;br clear=all /&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;[[Image:Example.png | 50px | thumb ]]&amp;lt;/nowiki&amp;gt; &amp;lt;/code&amp;gt; = [[Image:Example.png | 50px | thumb ]]&lt;br /&gt;
&amp;lt;br clear=all /&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;[[Image:Example.png | {{px|50}} | thumb ]]&amp;lt;/nowiki&amp;gt; &amp;lt;/code&amp;gt; = [[Image:Example.png | {{px|50}} | thumb ]]&lt;br /&gt;
&amp;lt;br clear=all /&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;[[Image:Example.png | {{px|50px}} | thumb ]]&amp;lt;/nowiki&amp;gt; &amp;lt;/code&amp;gt; = [[Image:Example.png | {{px|50px}} | thumb ]]&lt;br /&gt;
&amp;lt;br clear=all /&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;[[Image:Example.png | {{px|junk}} | thumb ]]&amp;lt;/nowiki&amp;gt; &amp;lt;/code&amp;gt; = [[Image:Example.png | {{px|junk}} | thumb ]]&lt;br /&gt;
&amp;lt;br clear=all /&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;[[Image:Example.png | {{px|}} | thumb ]]&amp;lt;/nowiki&amp;gt; &amp;lt;/code&amp;gt; = [[Image:Example.png | {{px|}} | thumb ]]&lt;br /&gt;
&amp;lt;br clear=all /&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;[[Image:Example.png | {{px}} | thumb ]]&amp;lt;/nowiki&amp;gt; &amp;lt;/code&amp;gt; = [[Image:Example.png | {{px}} | thumb ]]&lt;br /&gt;
&amp;lt;br clear=all /&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;[[Image:Example.png | {{px||50}} | thumb ]]&amp;lt;/nowiki&amp;gt; &amp;lt;/code&amp;gt; = [[Image:Example.png | {{px||50}} | thumb ]]&lt;br /&gt;
::Giving the default width if the 1st parameter is empty&lt;br /&gt;
&amp;lt;br clear=all /&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;[[Image:Example.png | {{px|{{{width|}}}|50}} | thumb ]]&amp;lt;/nowiki&amp;gt; &amp;lt;/code&amp;gt; = [[Image:Example.png | {{px|{{{width|}}}|50}} | thumb ]]&lt;br /&gt;
&amp;lt;br clear=all /&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;[[Image:Example.png | {{px|{{{width}}}|50}} | thumb ]]&amp;lt;/nowiki&amp;gt; &amp;lt;/code&amp;gt; = [[Image:Example.png | {{px|{{{width}}}|50}} | thumb ]]&lt;br /&gt;
::Fails to use the default value of 50. Note the missing &amp;quot;|&amp;quot; in&lt;br /&gt;
&amp;lt;nowiki&amp;gt;{{{width}}}&amp;lt;/nowiki&amp;gt; .&lt;br /&gt;
&amp;lt;br clear=all /&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;[[Image:Example.png | {{px| {{{width|}}} | {{{size|}}} | 50 }} | thumb ]]&amp;lt;/nowiki&amp;gt; &amp;lt;/code&amp;gt; = [[Image:Example.png | {{px| {{{width|}}} | {{{size|}}} | 50 }} | thumb ]]&lt;br /&gt;
&amp;lt;br clear=all /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;includeonly&amp;gt;&lt;br /&gt;
&amp;lt;!-- ADD CATEGORIES AND INTERWIKIS BELOW THIS LINE --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/includeonly&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[رده:Wikihaj metatemplates|{{PAGENAME}}]]&lt;/div&gt;</summary>
		<author><name>Hosainahmadi</name></author>
	</entry>
</feed>