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)

The shouldn't be used, it's deprecated. My best way is: Use 3 templates:

1- Template:Weapon (uses the other 2 templates, has the table and all its styling)

2- Template:Weapon Icon {{#switch:{{lc:{{{1}}}}} ... }}
 * ak-47 = Weapons-AK-47.png
 * m4 = Weapons-M4.png
 * gau-19 = Weapons-GAU-19.png

3- Template:Weapon Description {{#switch:{{lc:{{{1}}}}} ... }}
 * ak-47 = AK-47: The standard assault rifle in the Uncharted series.
 * m4 = M4: An elite assault rifle in the Uncharted series.
 * gau-19 = GAU-19: An powerful minigun exclusively wielded by Heavy Weapons Troops.

The {{lc:{{{1}}}}} may not be wanted in your wiki, I don't know if the guns' names can be lower case or not, but I've put it here for your consideration.

Also, it's not Shambhala Guardans. :p {{Unsigned|Nidek}}


 * I don't like Sovq's approach because there are two fields of data for each weapon, and I'm not sure how he'd combine them. However, Anon Nidek offers more flexibility, but has a bit more complexity. Anyways, you have plenty of solution now, hehe ;) Hunter789 15:41, August 25, 2011 (UTC)


 * @Nidek I might try that out in the future. But for now, I'll stick to Sovq's design which I currently have working, as I'm on a deadline. Thanks for pointing out the typo too. I don't know how I missed that :D One last question guys. If you look here, you'll see that I'm working to redesign our character articles, using the one via the link as a general template. If you scroll to the individual game sections, you'll see that I've put a border around them, a different color for each game. I've also added the logo of each game to the top of the "box." My problem is that the section headers are still there, making the logos redundant. Is there any way I can hide these headers, but somehow retain the edit links? The edit links have currently disappeared, probably because I set the templates up like an idiot. (And yes, I am a MediaWiki noob ;-) Thanks for all help in advance. --Klock101 22:08, August 25, 2011 (UTC)


 * You could do what I tested here. That will hide the headers but keep them in the table of contents. I don't know about the edit links though, you'd have to restore them first and see. — Sovq 06:23, August 26, 2011 (UTC)


 * Thanks Sovq, I was trying to figure that out by adding the style="display:none" in a tag before and after the == of the title. The engine would not let me send an = to the template. Nice and simple trick to fool it, though :P Hunter789 15:55, August 26, 2011 (UTC)


 * Something like that could do the trick.
 * [{{fullurl:{{FULLPAGENAME}}|action=edit}} edit]
 * It edits the full page. I think you wont be able to restore edit section links because the text of the sections come from what you inject in a template, so I think the wiki engine cannot recognize what exactly is a section (for edit). It'd have to select specific text in the original template call.
 * Hunter789 15:55, August 26, 2011 (UTC)