How to Create a Navbox: Difference between revisions

m
Line 10: Line 10:
*It is recommended that you create infobox tables in HTML as there fewer problems as you will see.
*It is recommended that you create infobox tables in HTML as there fewer problems as you will see.
*We will be creating a navbox as shown below. So let us create a navbox for a location:
*We will be creating a navbox as shown below. So let us create a navbox for a location:
<table style="width:100%; border:1px solid blue; background-color:{{{navbox background color}}}; border-collaspe:separate; border-spacing:5px; ">
<tr>
<td colspan="2" style="text-align:center; background-color:{{{title background color}}}; ">Links to {{{name}}} - related articles
</td>
</tr>
<!----ADDING GROUP NAMES AND ITEMS.  Each group is equipped with 20 items.  If you need more, you will have to add more items with this coding: {{#if:{{{group title1-item1|}}}|{{{group title1-item1}}}{{·}}|}}.  If you are increasing the number of items in a group, all you have to do is increase the item number for each new one added.  So if you add another item say number 21, the code becomes {{#if:{{{group title1-item21|}}}|{{{group title1-item21}}}{{·}}|}}.  But you have to add this new item coding between the last item and the final "|}}</td>"---->
<tr>
{{#if:{{Ifempty|{{{group title1|}}}}}|
<td style="text-align:right; width:15%; background-color:{{{left column background color}}}; ">'''{{{group title1}}}'''|}}</td>
{{#if:{{Ifempty|{{{group title1-item1|}}}}}|
<td style="text-align:left; background-color:{{{right column background color}}}; ">
{{#if:{{{group title1-item1|}}}|{{{group title1-item1}}}{{·}}|}} {{#if:{{{group title1-item2|}}}|{{{group title1-item2}}}{{·}}|}} {{#if:{{{group title1-item3|}}}{{·}}|{{{group title1-item3}}}{{·}}|}} {{#if:{{{group title1-item4|}}}|{{{group title1-item4}}}{{·}}|}} {{#if:{{{group title1-item5|}}}|{{{group title1-item5}}}{{·}}|}} {{#if:{{{group title1-item6|}}}|{{{group title1-item6}}}{{·}}|}} {{#if:{{{group title1-item7|}}}|{{{group title1-item7}}}{{·}}|}} {{#if:{{{group title1-item8|}}}|{{{group title1-item8}}}{{·}}|}} {{#if:{{{group title1-item9|}}}|{{{group title1-item9}}}{{·}}|}} {{#if:{{{group title1-item10|}}}|{{{group title1-item10}}}{{·}}|}} {{#if:{{{group title1-item11|}}}|{{{group title1-item11}}}{{·}}|}} {{#if:{{{group title1-item12|}}}|{{{group title1-item12}}}{{·}}|}} {{#if:{{{group title1-item13|}}}|{{{group title1-item13}}}{{·}}|}} {{#if:{{{group title1-item14|}}}|{{{group title1-item14}}}{{·}}|}} {{#if:{{{group title1-item15|}}}|{{{group title1-item15}}}{{·}}|}} {{#if:{{{group title1-item16|}}}|{{{group title1-item16}}}{{·}}|}} {{#if:{{{group title1-item17|}}}|{{{group title1-item17}}}{{·}}|}} {{#if:{{{group title1-item18|}}}|{{{group title1-item18}}}{{·}}|}} {{#if:{{{group title1-item19|}}}|{{{group title1-item19}}}{{·}}|}} {{#if:{{{group title1-item20|}}}|{{{group title1-item20}}}{{·}}|}}|}}</td>
{{#if:{{Ifempty|{{{group title1|}}}}}|
<td style="text-align:right; width:15%; background-color:{{{left column background color}}}; ">'''{{{group title1}}}'''|}}</td>
{{#if:{{Ifempty|{{{group title1-item1|}}}}}|
<td style="text-align:left; background-color:{{{right column background color}}}; ">
{{#if:{{{group title1-item1|}}}|{{{group title1-item1}}}{{·}}|}} {{#if:{{{group title1-item2|}}}|{{{group title1-item2}}}{{·}}|}} {{#if:{{{group title1-item3|}}}{{·}}|{{{group title1-item3}}}{{·}}|}} {{#if:{{{group title1-item4|}}}|{{{group title1-item4}}}{{·}}|}} {{#if:{{{group title1-item5|}}}|{{{group title1-item5}}}{{·}}|}} {{#if:{{{group title1-item6|}}}|{{{group title1-item6}}}{{·}}|}} {{#if:{{{group title1-item7|}}}|{{{group title1-item7}}}{{·}}|}} {{#if:{{{group title1-item8|}}}|{{{group title1-item8}}}{{·}}|}} {{#if:{{{group title1-item9|}}}|{{{group title1-item9}}}{{·}}|}} {{#if:{{{group title1-item10|}}}|{{{group title1-item10}}}{{·}}|}} {{#if:{{{group title1-item11|}}}|{{{group title1-item11}}}{{·}}|}} {{#if:{{{group title1-item12|}}}|{{{group title1-item12}}}{{·}}|}} {{#if:{{{group title1-item13|}}}|{{{group title1-item13}}}{{·}}|}} {{#if:{{{group title1-item14|}}}|{{{group title1-item14}}}{{·}}|}} {{#if:{{{group title1-item15|}}}|{{{group title1-item15}}}{{·}}|}} {{#if:{{{group title1-item16|}}}|{{{group title1-item16}}}{{·}}|}} {{#if:{{{group title1-item17|}}}|{{{group title1-item17}}}{{·}}|}} {{#if:{{{group title1-item18|}}}|{{{group title1-item18}}}{{·}}|}} {{#if:{{{group title1-item19|}}}|{{{group title1-item19}}}{{·}}|}} {{#if:{{{group title1-item20|}}}|{{{group title1-item20}}}{{·}}|}}|}}</td>
</tr>
</table>


*Now pay close attention to the table tags.  You should notice this coding: <font color="red"><nowiki>class="infobox"</nowiki></font color> in the table tag .  This code tells the browser that a infobox is being created and to place it on the right hand side of the article.
*Now pay close attention to the table tags.  You should notice this coding: <font color="red"><nowiki>class="infobox"</nowiki></font color> in the table tag .  This code tells the browser that a infobox is being created and to place it on the right hand side of the article.
Line 15: Line 34:
*When you save your infobox be sure include the word "infobox" in the title so people will know what kind of template it is for example: <font color="red"><nowiki>{{template:infobox sample}}</nowiki></font color>.
*When you save your infobox be sure include the word "infobox" in the title so people will know what kind of template it is for example: <font color="red"><nowiki>{{template:infobox sample}}</nowiki></font color>.
----
----
===Step Two - Create the template===
===Step Two - Create the template===
[[User:Ccsmith/sandbox/navbox|User:Ccsmith/sandbox/navbox]]
[[User:Ccsmith/sandbox/navbox|User:Ccsmith/sandbox/navbox]]
Interface administrators, smwadministrator, smwcurator, smweditor
82,369

edits