Forum:How would I make this template?

So, I'm hoping to make a template on the Uncharted wiki. Basically, it would go in character articles and would show what weapon(s) a particular character uses. Ideally, it would work as follows: with the "AK-47", "RPG-7" and "Pistol" parts resulting in an image of the weapon(s), possibly along with some info about them, neatly laid out. Unfortunately, I have absolutely no idea how you would go about making a template like this. Any help is appreciated. Thanks. --Klock101 19:34, August 23, 2011 (UTC)


 * I would create two templates. One for choosing an appropriate weapon icon, let's call it Weapon Icon, i.e.


 * and after that a general template which does what you described, i.e.


 * This can also be done with just one template - just requires more copy/pasting. Of course, depending on what you want the output to look like, you would need to style, format and adjust these templates accordingly. — Sovq 19:53, August 23, 2011 (UTC)


 * What I would do is have a page for each weapon, and on each of these pages, write the information you want to be displayed when inserted. Name them like "AK-47 template content", "RPG-7 template content", "Pistol".


 * To make those pages, you could use a template, say, which would be built so that including many at the same time would give a nice result.


 * Then, in the template, I'd make a series of ifs a bit like this here but using named parameters  . If a field exists, you include the article.


 * This can make quite complex templates, but it's soooo much fun and it makes article editing much easier!
 * Hunter789 20:09, August 23, 2011 (UTC)


 * @Hunter789 That sounds a bit complicated for me ;-) I tried out Sovq's template and it worked perfectly. There's just one more thing. As it is, the weapons are just appearing as images, one beneath the other, which you can see here. I added some text beside the AK-47 and plan to add text beside all of them. Obviously, as it is now, it wont look good in articles, so I'm wondering how to make it so that the template will put them in a table. I'm guessing it will have something to do with editing the Weapon Icon template? Thanks in advane for all help. --Klock101 00:01, August 25, 2011 (UTC)


 * Yup, and add the table 'top' and 'botton' code to Template:Weapon. And here is how I see the top of your weapon icon template:

{{#switch:{{{1}}}
 * AK-47=Weapons-AK-47.png AK-47||The standard assault rifle in the Uncharted series.
 * I'm not sure how the || will behave within the template inclusion, though. If it does not work, make 2 switch, one for the weapon icon, one for the description, and have the | symbol between them. Hunter789 01:38, August 25, 2011 (UTC)

{{ri}} If I were you, I wouldn't change the Weapon Icon template and put all the table formatting into the Weapon template. The reason for that is that you might want to use the icons in other places without excess table formatting. The Weapon template would need to be adjusted to something like:

or expanded even further, if you want the descriptions to be stored in separate parameters/table cells. — Sovq 06:05, August 25, 2011 (UTC)