Wersije přirunać

How to use "For" tags

Wersija 33410:

Wersija 33410 wot wužiwarja scoobidiver

Wersija 44356:

Wersija 44356 wot wužiwarja AliceWyman

Klučowe słowa:

Zjeće pytanskich wuslědkow:

How to use for
How to use for

Wobsah:

One of the great features of our Knowledge Base is the ability to show instructions customized for operating systems (Windows, Android, etc.) and Firefox versions. We can say, for example, that a certain section of a help article is "for" Windows users and Mac and Linux users won't see it. The feature is designed to work invisibly. When someone opens a help article, we'll automatically detect what operating system and version of Firefox they are using and show the appropriate instructions. This article goes over the details of how to use <nowiki>{</nowiki>for<nowiki>}</nowiki> in Knowledge Base articles. __TOC__ = How to switch instructions to different operating systems or Firefox versions = In order to follow the example in this article, you'll have to switch the article selector to different operating systems and Firefox versions. It's located at the top of the article.<br><br>[[Image:Article Selectors]] = Basic syntax and behavior = ==Operating Systems== Here is the syntax to show an image for '''Windows 7/Vista''':<br> '''<code><nowiki>{</nowiki>for win7<nowiki>}</nowiki><nowiki>[[</nowiki>Image:vista.jpg]]<nowiki>{</nowiki>/for<nowiki>}</nowiki></code>''' *Change the selector to Windows 7/Vista to see the image:<br>{for win7}<br>[[Image:vista.jpg]]{/for} {for win7} *If you change the selector to Windows XP, Windows 8, Mac OS X or Linux, the image above won't be shown because it's not "for" them. {/for} Although the Windows selector doesn't exist, you can write instructions that apply to all Windows versions:<br> '''<code><nowiki>{</nowiki>for win<nowiki>}</nowiki><nowiki>[[</nowiki>Image:Windows Logo]]<nowiki>{</nowiki>/for<nowiki>}</nowiki></code>''' *Change the selector to Windows XP, Windows 7/Vista, or Windows 8 to see the image:<br>{for win}<br>[[Image:Windows Logo]]{/for} {for win} *If you change the selector to Mac OS X or Linux, the image above won't be shown because it's not "for" them. {/for} {/for} {note}'''Note:''' If you change the selector to Android the image is visible even though it isn't specified. That's because we default to showing Windows 7/Vista instructions (unless otherwise specified) if you are using Firefox on mobile. We also default to showing Android instructions if you are looking at [/products/mobile Mobile article] with Windows, Mac or Linux.{/note} ==Firefox versions== Here is the syntax to show something for '''Firefox 16 and above''':<br> '''<code><nowiki>{</nowiki>for fx16<nowiki>}</nowiki><nowiki>[[</nowiki>Image:Firefox Logo]]<nowiki>{</nowiki>/for<nowiki>}</nowiki></code>''' *Change the selector to Firefox 16 or higher to see the image:<br>{for fx16}<br>[[Image:Firefox Logo]]{/for} {for fx16} *If you change the selector to Firefox ESR the message above will disappear because it's not "for" them. {/for} ===Show instructions for only one version of Firefox=== To show instructions '''only for Firefox 16''', use the "=" operator:<br> '''<code><nowiki>{</nowiki>for =fx16<nowiki>}</nowiki><nowiki>[[</nowiki>Image:Firefox Logo]]<nowiki>{</nowiki>/for<nowiki>}</nowiki></code>''' *Now the image only shows when you change the selector to Firefox 16:<br>{for =fx16}<br>[[Image:Firefox Logo]]{/for} ==Combining operating systems & Firefox versions== You can specify an operating system and a Firefox version by separating them with a comma:<br> '''<code><nowiki>{</nowiki>for win,fx16<nowiki>}</nowiki><nowiki>[[</nowiki>Image:Windows Logo]]<nowiki>[[</nowiki>Image:Firefox Logo]]<nowiki>{</nowiki>/for<nowiki>}</nowiki></code>''' *Change the selector to Windows and Firefox 16 or higher to see images: <br>{for win,fx16}<br>[[Image:Windows Logo]][[Image:Firefox Logo]]{/for} A more complex situation with an implied "or" can be written like this:<br> '''<code><nowiki>{</nowiki>for mac, winxp, win7, =fx10, fx16<nowiki>}</nowiki><nowiki>[[</nowiki>Image:Windows Logo]]<nowiki>[[</nowiki>Image:macos.jpg]]<nowiki>[[</nowiki>Image:Firefox Logo]]<nowiki>{</nowiki>/for<nowiki>}</nowiki></code>''' *Change the selector to Mac or Windows XP or Windows 7/Vista and Firefox ESR or Firefox 16 and above to see images:<br>{for mac, winxp, win7, =fx10, fx16}<br>[[Image:Windows Logo]][[Image:macos.jpg]][[Image:Firefox Logo]]{/for} Formally, the markup between <nowiki>{</nowiki>for<nowiki>}</nowiki> and <nowiki>{</nowiki>/for<nowiki>}</nowiki> will be ''shown'' if either of these conditions is met: * The <nowiki>{</nowiki>for<nowiki>}</nowiki> lists at least one OS and includes the one the user is running (or has manually selected). * The <nowiki>{</nowiki>for<nowiki>}</nowiki> lists at least one Firefox version and includes the one the user is running (or has manually selected). Otherwise, the contents of the <nowiki>{</nowiki>for<nowiki>}</nowiki>...<nowiki>{</nowiki>/for<nowiki>}</nowiki> is not shown. A few other things to note: * Spaces after the commas are optional. * The <nowiki>{</nowiki>for<nowiki>}</nowiki> syntax only works on Firefox Knowledge Base articles. * <nowiki>{</nowiki>for<nowiki>}</nowiki> and other wiki markup doesn't work in article search summaries. * Headings which are hidden by <nowiki>{</nowiki>for<nowiki>}</nowiki> blocks do not appear in the page's table of contents. If the user causes them to show by manually selecting the right OS/browser combination, the table of contents entries instantly appear. == Operating system and browser abbreviations == These are the operating system and browser abbreviations available for use with <nowiki>{</nowiki>for<nowiki>}</nowiki>: * win (Windows) * winxp (Windows XP/2000/Server 2003) * win7 (Windows 7/Vista/Server 2008) * win8 (Windows 8/Server 2012) * mac (Mac OS X) * linux (Linux) * android (Android mobile OS) * fxN where N = the Firefox version, i.e. fx15, fx16, fx17, etc. * mN where M = the Firefox version, i.e. m15, m16, m17, etc. {note}'''Note:''' Every six weeks we add support for the latest beta version of Firefox. At the same time we remove the oldest version from the selector but the old markup will still work. So, for example, if someone views an article with Firefox 7 they will see instructions for their version.{/note} == Inline and block-level contexts == <nowiki>{</nowiki>for<nowiki>}</nowiki> can be used in both inline and block-level contexts (in the HTML sense). The inline form takes effect when working within a line of text: '''This is <nowiki>{</nowiki>for win<nowiki>}</nowiki>inline use<nowiki>{</nowiki>/for<nowiki>}</nowiki>.''' The block form is used to wrap entire paragraphs, ordered lists, headings, and so on. The only caveat is that, when using the block form, the <nowiki>{</nowiki>for<nowiki>}</nowiki> and <nowiki>{</nowiki>/for<nowiki>}</nowiki> should each be on a line by itself. Otherwise, it might be considered part of a neighboring paragraph and produce surprising results. '''<nowiki>{</nowiki>for win<nowiki>}</nowiki><br>''' '''This is block-level.<br>''' '''<nowiki>*</nowiki>One<br>''' '''<nowiki>*</nowiki>Two<br>''' '''<nowiki>{</nowiki>/for<nowiki>}</nowiki>''' ==Using the handy dandy <nowiki>{</nowiki>for<nowiki>}</nowiki> button in the article editor== When you're editing a Knowledge Base article you can use the <nowiki>{</nowiki>for<nowiki>}</nowiki> button in the toolbar to write the markup for you. #Highlight the text you want to put <nowiki>{</nowiki>for<nowiki>}</nowiki> tags around. #Click {button Show for...} in the editing toolbar. #Check the boxes next to the Firefox versions and operating systems that you want to see this piece of content and then click {button Add Rule}. The customized <nowiki>{</nowiki>for<nowiki>}</nowiki> tags will be placed around the section you highlighted. =Best practices for using <nowiki>{</nowiki>for} in articles= '''When writing instructions for different operating systems, it's best to write complete sentences and paragraphs for each OS/Firefox version even if it means duplicating things.''' This makes the article easier to understand, maintain and localize. When it comes time, for example, to remove specific instructions for Firefox 6 and below, those sections can just be deleted rather than trying to excise them from a larger section. '''Example:'''<br> '''Bad'''<br> <nowiki>#</nowiki><nowiki>{</nowiki>for win,linux}At the top of the Firefox window<nowiki>{</nowiki>/for}<nowiki>{</nowiki>for mac}On the menu bar<nowiki>{</nowiki>/for}, click on the <nowiki>{</nowiki>for fx35}<nowiki>{menu</nowiki> Tools}<nowiki>{</nowiki>/for}<nowiki>{</nowiki>for mac,linux,fx4}<nowiki>{menu</nowiki> Tools}{/for}<nowiki>{</nowiki>for win,fx4}<nowiki>{menu</nowiki> Firefox} menu, go over to the <nowiki>{menu</nowiki> History} menu and select <nowiki>{menu</nowiki> Clear Recent History...}<nowiki>{</nowiki>/for}<nowiki>{</nowiki>for not win,fx4} menu, and select <nowiki>{</nowiki>/for}<nowiki>{</nowiki>for win,fx35}<nowiki>{menu</nowiki> Clear Recent History...}<nowiki>{</nowiki>/for}<nowiki>{</nowiki>for mac,linux}<nowiki>{menu</nowiki> Clear Recent History...}<nowiki>{</nowiki>/for} <nowiki>{</nowiki>for win,fx4}<nowiki><br>'''</nowiki>For Windows XP:<nowiki>'''</nowiki> At the top of the Firefox window, click on the <nowiki>{menu</nowiki> Tools} menu and select <nowiki>{menu</nowiki> Clear Recent History...}<nowiki>{</nowiki>/for} '''Good'''<br> <nowiki>{</nowiki>for fx4}<br> <nowiki>#</nowiki><nowiki>{</nowiki>for win}At the top of the Firefox window, click on the <nowiki>{menu</nowiki> Firefox} menu, go over to the <nowiki>{menu</nowiki> History} menu and select <nowiki>{menu</nowiki> Clear Recent History...} (<nowiki>'''</nowiki>Windows XP:<nowiki>'''</nowiki> Click on the <nowiki>{menu</nowiki> Tools} menu and select <nowiki>{menu</nowiki> Clear Recent History...}).<nowiki>{</nowiki>/for}<nowiki>{</nowiki>for mac}On the menu bar, click on the <nowiki>{menu</nowiki> Tools} menu and select <nowiki>{menu</nowiki> Clear Recent History...}<nowiki>{</nowiki>/for}<nowiki>{</nowiki>for linux}At the top of the Firefox window, click on the <nowiki>{menu</nowiki> Tools} menu and select <nowiki>{menu</nowiki> Clear Recent History...}<nowiki>{</nowiki>/for}<br> <nowiki>{</nowiki>/for}<br> <nowiki>{</nowiki>for fx35}<br> <nowiki>#</nowiki><nowiki>{</nowiki>for win,linux}At the top of the Firefox window, click on the <nowiki>{menu</nowiki> Tools} menu and select <nowiki>{menu</nowiki> Clear Recent History...}<nowiki>{</nowiki>/for}<nowiki>{</nowiki>for mac}On the menu bar, click on the <nowiki>{menu</nowiki> Tools} menu and select <nowiki>{menu</nowiki> Clear Recent History...}<nowiki>{</nowiki>/for}<br> <nowiki>{</nowiki>/for}<br> '''Another example:'''<br> In the example below, we treat Firefox 14 and below, Firefox 15/16, and Firefox 17 and above as three different sets of instructions. That's often the case but more and more as we change Firefox every six weeks we'll see more changes in later versions. They'll look like this: '''Good:'''<br> <nowiki>{</nowiki>for not fx15}<br> <nowiki>#</nowiki>The old instructions.<br> <nowiki>{</nowiki>/for}<br> <nowiki>{</nowiki>for =fx15,=fx16}<br> <nowiki>#</nowiki>The new instructions.<br> <nowiki>{</nowiki>/for}<br> <nowiki>{</nowiki>for fx17}<br> <nowiki>#</nowiki>The NEW new instructions.<br> <nowiki>{</nowiki>/for}
One of the great features of our Knowledge Base is the ability to show instructions customized for operating systems (Windows, Android, etc.) and Firefox versions. We can say, for example, that a certain section of a help article is "for" Windows users and Mac and Linux users won't see it. The feature is designed to work invisibly. When someone opens a help article, we'll automatically detect what operating system and version of Firefox they are using and show the appropriate instructions. This article goes over the details of how to use <nowiki>{</nowiki>for<nowiki>}</nowiki> in Knowledge Base articles. __TOC__ = How to switch instructions to different operating systems or Firefox versions = In order to follow the example in this article, you'll have to switch the article selector to different operating systems and Firefox versions. It's located at the top of the article.<br><br>[[Image:Article Selectors]] = Basic syntax and behavior = ==Operating Systems== Here is the syntax to show an image for '''Windows 7/Vista''':<br> '''<code><nowiki>{</nowiki>for win7<nowiki>}</nowiki><nowiki>[[</nowiki>Image:vista.jpg]]<nowiki>{</nowiki>/for<nowiki>}</nowiki></code>''' *Change the selector to Windows 7/Vista to see the image:<br>{for win7}<br>[[Image:vista.jpg]]{/for} {for win7} *If you change the selector to Windows XP, Windows 8, Mac OS X or Linux, the image above won't be shown because it's not "for" them. {/for} Although the Windows selector doesn't exist, you can write instructions that apply to all Windows versions:<br> '''<code><nowiki>{</nowiki>for win<nowiki>}</nowiki><nowiki>[[</nowiki>Image:Windows Logo]]<nowiki>{</nowiki>/for<nowiki>}</nowiki></code>''' *Change the selector to Windows XP, Windows 7/Vista, or Windows 8 to see the image:<br>{for win}<br>[[Image:Windows Logo]]{/for} {for win} *If you change the selector to Mac OS X or Linux, the image above won't be shown because it's not "for" them. {/for} {/for} {note}'''Note:''' If you change the selector to Android the image is visible even though it isn't specified. That's because we default to showing Windows 7/Vista instructions (unless otherwise specified) if you are using Firefox on mobile. We also default to showing Android instructions if you are looking at [/products/mobile Mobile article] with Windows, Mac or Linux.{/note} ==Firefox versions== Here is the syntax to show something for '''Firefox 22 and above''':<br> '''<code><nowiki>{</nowiki>for fx22<nowiki>}</nowiki><nowiki>[[</nowiki>Image:Firefox Logo]]<nowiki>{</nowiki>/for<nowiki>}</nowiki></code>''' *Change the selector to Firefox 22 or higher to see the image:<br>{for fx22}<br>[[Image:Firefox Logo]]{/for} {for fx22} *If you change the selector to Firefox ESR the message above will disappear because it's not "for" that version (Firefox ESR is currently based on Firefox 17). {/for} ===Show instructions for only one version of Firefox=== To show instructions '''only for Firefox 22''', use the "=" operator:<br> '''<code><nowiki>{</nowiki>for =fx22<nowiki>}</nowiki><nowiki>[[</nowiki>Image:Firefox Logo]]<nowiki>{</nowiki>/for<nowiki>}</nowiki></code>''' *Now the image only shows when you change the selector to Firefox 22:<br>{for =fx22}<br>[[Image:Firefox Logo]]{/for} ==Combining operating systems & Firefox versions== You can specify an operating system and a Firefox version by separating them with a comma:<br> '''<code><nowiki>{</nowiki>for win,fx22<nowiki>}</nowiki><nowiki>[[</nowiki>Image:Windows Logo]]<nowiki>[[</nowiki>Image:Firefox Logo]]<nowiki>{</nowiki>/for<nowiki>}</nowiki></code>''' *Change the selector to Windows and Firefox 22 or higher to see images: <br>{for win,fx22}<br>[[Image:Windows Logo]][[Image:Firefox Logo]]{/for} A more complex situation with an implied "or" can be written like this:<br> '''<code><nowiki>{</nowiki>for mac, winxp, win7, =fx17, fx22<nowiki>}</nowiki><nowiki>[[</nowiki>Image:Windows Logo]]<nowiki>[[</nowiki>Image:macos.jpg]]<nowiki>[[</nowiki>Image:Firefox Logo]]<nowiki>{</nowiki>/for<nowiki>}</nowiki></code>''' *Change the selector to Mac or Windows XP or Windows 7/Vista and Firefox ESR or Firefox 22 and above to see images:<br>{for mac, winxp, win7, =fx17, fx22}<br>[[Image:Windows Logo]][[Image:macos.jpg]][[Image:Firefox Logo]]{/for} Formally, the markup between <nowiki>{</nowiki>for<nowiki>}</nowiki> and <nowiki>{</nowiki>/for<nowiki>}</nowiki> will be ''shown'' if either of these conditions is met: * The <nowiki>{</nowiki>for<nowiki>}</nowiki> lists at least one OS and includes the one the user is running (or has manually selected). * The <nowiki>{</nowiki>for<nowiki>}</nowiki> lists at least one Firefox version and includes the one the user is running (or has manually selected). Otherwise, the contents of the <nowiki>{</nowiki>for<nowiki>}</nowiki>...<nowiki>{</nowiki>/for<nowiki>}</nowiki> is not shown. A few other things to note: * Spaces after the commas are optional. * The <nowiki>{</nowiki>for<nowiki>}</nowiki> syntax only works on Firefox Knowledge Base articles. * <nowiki>{</nowiki>for<nowiki>}</nowiki> and other wiki markup doesn't work in article search summaries. * Headings which are hidden by <nowiki>{</nowiki>for<nowiki>}</nowiki> blocks do not appear in the page's table of contents. If the user causes them to show by manually selecting the right OS/browser combination, the table of contents entries instantly appear. == Operating system and browser abbreviations == These are the operating system and browser abbreviations available for use with <nowiki>{</nowiki>for<nowiki>}</nowiki>: * win (Windows) * winxp (Windows XP/2000/Server 2003) * win7 (Windows 7/Vista/Server 2008) * win8 (Windows 8/Server 2012) * mac (Mac OS X) * linux (Linux) * android (Android mobile OS) * fxN where N = the Firefox version, i.e. fx15, fx16, fx17, etc. * mN where M = the Firefox version, i.e. m15, m16, m17, etc. {note}'''Note:''' Every six weeks we add support for the latest beta version of Firefox. At the same time we remove the oldest version from the selector but the old markup will still work. So, for example, if someone views an article with Firefox 7 they will see instructions for their version.{/note} == Inline and block-level contexts == <nowiki>{</nowiki>for<nowiki>}</nowiki> can be used in both inline and block-level contexts (in the HTML sense). The inline form takes effect when working within a line of text: '''This is <nowiki>{</nowiki>for win<nowiki>}</nowiki>inline use<nowiki>{</nowiki>/for<nowiki>}</nowiki>.''' The block form is used to wrap entire paragraphs, ordered lists, headings, and so on. The only caveat is that, when using the block form, the <nowiki>{</nowiki>for<nowiki>}</nowiki> and <nowiki>{</nowiki>/for<nowiki>}</nowiki> should each be on a line by itself. Otherwise, it might be considered part of a neighboring paragraph and produce surprising results. '''<nowiki>{</nowiki>for win<nowiki>}</nowiki><br>''' '''This is block-level.<br>''' '''<nowiki>*</nowiki>One<br>''' '''<nowiki>*</nowiki>Two<br>''' '''<nowiki>{</nowiki>/for<nowiki>}</nowiki>''' ==Using the handy dandy <nowiki>{</nowiki>for<nowiki>}</nowiki> button in the article editor== When you're editing a Knowledge Base article you can use the <nowiki>{</nowiki>for<nowiki>}</nowiki> button in the toolbar to write the markup for you. #Highlight the text you want to put <nowiki>{</nowiki>for<nowiki>}</nowiki> tags around. #Click {button Show for...} in the editing toolbar. #Check the boxes next to the Firefox versions and operating systems that you want to see this piece of content and then click {button Add Rule}. The customized <nowiki>{</nowiki>for<nowiki>}</nowiki> tags will be placed around the section you highlighted. =Best practices for using <nowiki>{</nowiki>for} in articles= '''When writing instructions for different operating systems, it's best to write complete sentences and paragraphs for each OS/Firefox version even if it means duplicating things.''' This makes the article easier to understand, maintain and localize. When it comes time, for example, to remove specific instructions for Firefox 6 and below, those sections can just be deleted rather than trying to excise them from a larger section. '''Example:'''<br> '''Bad'''<br> <nowiki>#</nowiki><nowiki>{</nowiki>for win,linux}At the top of the Firefox window<nowiki>{</nowiki>/for}<nowiki>{</nowiki>for mac}On the menu bar<nowiki>{</nowiki>/for}, click on the <nowiki>{</nowiki>for fx35}<nowiki>{menu</nowiki> Tools}<nowiki>{</nowiki>/for}<nowiki>{</nowiki>for mac,linux,fx4}<nowiki>{menu</nowiki> Tools}{/for}<nowiki>{</nowiki>for win,fx4}<nowiki>{menu</nowiki> Firefox} menu, go over to the <nowiki>{menu</nowiki> History} menu and select <nowiki>{menu</nowiki> Clear Recent History...}<nowiki>{</nowiki>/for}<nowiki>{</nowiki>for not win,fx4} menu, and select <nowiki>{</nowiki>/for}<nowiki>{</nowiki>for win,fx35}<nowiki>{menu</nowiki> Clear Recent History...}<nowiki>{</nowiki>/for}<nowiki>{</nowiki>for mac,linux}<nowiki>{menu</nowiki> Clear Recent History...}<nowiki>{</nowiki>/for} <nowiki>{</nowiki>for win,fx4}<nowiki><br>'''</nowiki>For Windows XP:<nowiki>'''</nowiki> At the top of the Firefox window, click on the <nowiki>{menu</nowiki> Tools} menu and select <nowiki>{menu</nowiki> Clear Recent History...}<nowiki>{</nowiki>/for} '''Good'''<br> <nowiki>{</nowiki>for fx4}<br> <nowiki>#</nowiki><nowiki>{</nowiki>for win}At the top of the Firefox window, click on the <nowiki>{menu</nowiki> Firefox} menu, go over to the <nowiki>{menu</nowiki> History} menu and select <nowiki>{menu</nowiki> Clear Recent History...} (<nowiki>'''</nowiki>Windows XP:<nowiki>'''</nowiki> Click on the <nowiki>{menu</nowiki> Tools} menu and select <nowiki>{menu</nowiki> Clear Recent History...}).<nowiki>{</nowiki>/for}<nowiki>{</nowiki>for mac}On the menu bar, click on the <nowiki>{menu</nowiki> Tools} menu and select <nowiki>{menu</nowiki> Clear Recent History...}<nowiki>{</nowiki>/for}<nowiki>{</nowiki>for linux}At the top of the Firefox window, click on the <nowiki>{menu</nowiki> Tools} menu and select <nowiki>{menu</nowiki> Clear Recent History...}<nowiki>{</nowiki>/for}<br> <nowiki>{</nowiki>/for}<br> <nowiki>{</nowiki>for fx35}<br> <nowiki>#</nowiki><nowiki>{</nowiki>for win,linux}At the top of the Firefox window, click on the <nowiki>{menu</nowiki> Tools} menu and select <nowiki>{menu</nowiki> Clear Recent History...}<nowiki>{</nowiki>/for}<nowiki>{</nowiki>for mac}On the menu bar, click on the <nowiki>{menu</nowiki> Tools} menu and select <nowiki>{menu</nowiki> Clear Recent History...}<nowiki>{</nowiki>/for}<br> <nowiki>{</nowiki>/for}<br> '''Another example:'''<br> In the example below, we treat Firefox 14 and below, Firefox 15/16, and Firefox 17 and above as three different sets of instructions. That's often the case but more and more as we change Firefox every six weeks we'll see more changes in later versions. They'll look like this: '''Good:'''<br> <nowiki>{</nowiki>for not fx15}<br> <nowiki>#</nowiki>The old instructions.<br> <nowiki>{</nowiki>/for}<br> <nowiki>{</nowiki>for =fx15,=fx16}<br> <nowiki>#</nowiki>The new instructions.<br> <nowiki>{</nowiki>/for}<br> <nowiki>{</nowiki>for fx17}<br> <nowiki>#</nowiki>The NEW new instructions.<br> <nowiki>{</nowiki>/for}

Wróćo k historiji