Interface administrators, smwadministrator, smwcurator, smweditor
82,369
edits
Line 262: | Line 262: | ||
*This coding is testing to see if there is a positive value in the test string or if there is any peanut butter. If there is a positive value, the browser picks the first option, “make sandwich” if there is no value or no peanut butter, it picks the second option “starve.” | *This coding is testing to see if there is a positive value in the test string or if there is any peanut butter. If there is a positive value, the browser picks the first option, “make sandwich” if there is no value or no peanut butter, it picks the second option “starve.” | ||
*So if there really is NO peanut butter, you can leave the space is blank like so: | *So if there really is NO peanut butter, you can leave the space is blank like so: | ||
<nowiki>{{#if(blank)|make sandwich|starve}}</nowiki> and it picks the second option which is starvation. | <nowiki>{{#if:(blank)|make sandwich|starve}}</nowiki> and it picks the second option which is starvation. | ||
*Now what if we do not want the word “starve” to show at all? What if we do not even want to mention peanut butter if there isn’t any. Well, enter the code in this manner: | *Now what if we do not want the word “starve” to show at all? What if we do not even want to mention peanut butter if there isn’t any. Well, enter the code in this manner: | ||
<nowiki>{{#if(blank)|make sandwich}}</nowiki> result: (blank line). | <nowiki>{{#if:(blank)|make sandwich}}</nowiki> result: (blank line). | ||
*Notice the second option is left out. With the second option missing the browser’s only choice is to ignore the whole line of code and give us a blank line. | *Notice the second option is left out. With the second option missing the browser’s only choice is to ignore the whole line of code and give us a blank line. | ||
*In our coding for creating this infobox, we are using parameters which are enclosed by <nowiki>{{{}}}</nowiki>. To show a non value for peanut butter instead of leaving a blank space, we add the pipe after the word “peanut butter” like so: | *In our coding for creating this infobox, we are using parameters which are enclosed by <nowiki>{{{}}}</nowiki>. To show a non value for peanut butter instead of leaving a blank space, we add the pipe after the word “peanut butter” like so: |