Forum:Help Learning how to make a Template

Hey, I'm trying to figure out how to make an infobox template to my liking. I know you guys must have a BUNCH of "How do I make templates" questions, but I feel this one may have some unique problems. I want to make a infobox for a reptile wiki, you see. I want it to look something like this:

It looks nice, but theres a problem --- I have no clue how to do that! I looked at the Template: Infobox and looked at it, but I still had no idea how to do what I wanted it to do. How do I make it my color scheme? How do I make it have banners? How do I make the top banner round slightly? And how do I make some parts split apart like that? Sorry if I'm asking so many questions, but I looked around on every single How to make templates article on nearly every wiki I could find, and the results were either not there, or VERY vague. Could someone tell me how to do this? Thesaurus Rex 17:11, April 21, 2010 (UTC)


 * Looks pretty much just like the creature infobox on SporeWiki (look at w:c:spore:Grox for an example). Feel free to copy (template code, css and js is needed). Ask if you're unsure how. 17:23, April 21, 2010 (UTC)


 * Tip - As Ose says copy something similar from another Wiki to your wiki as is & save it. Then see if it still works ok (ignore red article links). Then open it up to edit and look for the bits that create the heading words and row lables and experiment with changing them to text that suites your usage. Use preiew to check and save when you have some working (then if it goes wrong you can take a step back). For colour codes there is a page on wikipedia that lists them web colors IIRC. You then need to update the parameter elements that pass the dat to the template -
 * in the template and "|item_one = " on the page the template is used on. Updating each one to make sense to your users so it easier to fill in.


 * Some items will only show if the parameter is filled in when the template is used, and auto blank the row label if no data is supplied.


 * Look out for missing sub templates seen as a red Templae:xyz link within the template when displayed on the page or at the bottom of the edit page during preview were it shows as " template:xyz {edit] in red.


 * Note:- your sample there has collapsible sections which may need additional code adding to your wikis Mediawiki:Common.cs and .JS files as Ose mentions to get them to function.


 * - BulldozerD11 19:10, April 21, 2010 (UTC)


 * I threw together a how-to at w:c:dev:CollapsibleInfobox. If you follow the instructions it should work (you'll need to be an admin to edit the common css and js files, see Project:Adoption requests for that). 20:23, April 21, 2010 (UTC)
 * Hi, I went and took a look at the Infobox (collapsible) template you had, but when I saw it's edit page, it was so incredibly complex that I couldn't make it out . I don't know how to modify THAT! How did you even make that??? Is all that extra code a result of you typing something a bit more basic and having it unfold (like the four tildes in a signature), did you type all that out, or am I just reading this wrong? All this is very discouraging for someone like me. Is there no easy way to learn templates? All the articles on them I've found either list existing templates, some techniques, etc. I have yet to find a good tutorial. But I'm going to try to experiment with what I have, it it doesn't make my brain explode before I get something right >.> Thesaurus Rex 07:50, April 23, 2010 (UTC)


 * The extra code is there because Ose wanted to make sure that the template wouldn't run out of rows. :P As a result, there are dozens of rows. He's coded each row using a parser function, which basically means that unless you are actually using that row (you've entered something in it), it won't show up. The stuff inside the the curly brackets e.g.  are parameters for using the template.
 * Certainly, that template isn't too hard to use; Ose's explanation basically means you can have headers and labels etc. if you just take that template without changing it around too much (and add the extra stuff as detailed on the explanation to Common.js and Common.css). If you do want to create something like that, then they're all that complex, unfortunately. If you're interested though, you can start reading at Help:Templates, Help:Creating templates, Help:Template parameters and Help:Infobox. The 888th Avatar   (talk)  08:29, April 23, 2010 (UTC)


 * Well, I've already saw all those Help pages. It's definitely going to take me a while to learn templates. Is there any way I can request this kind of template? Thesaurus Rex 12:16, April 23, 2010 (UTC)


 * You can follow the instructions on w:c:dev:CollapsibleInfobox. That should get it working. To customize the colors you can use CSS. 13:39, April 23, 2010 (UTC)


 * Well, I *think* I get the idea now. But what I'm going to try, is I'm going to play around in sandboxes making basic templates, and just work my way up to more advanced ones. But in the meantime, is there a place I can go to to request templates? Or can I just request one in the forums? (I should probably make another topic for it though, right?) Thesaurus Rex 07:04, April 24, 2010 (UTC)


 * You can request one here at the forums. New topic or not, someone will pick it up. :) The 888th Avatar   (talk)  09:53, April 24, 2010 (UTC)


 * Just to share my experience with you. Exactly 1 year 1 month ago, I knew absolutely zero wiki code, don't even know how to add simple text using the 'edit' button :). So don't be discouraged, templates can be very easy if you omit:
 * the parser functions,
 * the CSS styles (required for the rounded corners you want on that template of yours)
 * JS or javascript (required for the show/hide feature)
 * and concentrate on the look of the table (or div) first.
 * Reason being some functions may not be turned on on your particular wiki or are special requests, and bear in mind some are expensive parsers which may be terminated by the servers (which you have no control over) after say, 100 iterations. And you will only discover this (when your page refuses to display properly because you didn't realise there were more than 100 of them) after you have perhaps spent a few weeks coding & implementing that darn template :). CSS styles do not show up immediately and so are impossible to preview while you are designing the template, which makes it frustrating. I have put in a policy on the wiki I am active on to avoid CSS wherever possible and add code colours/styles/layout into templates as far as possible. In this way, non-sysop users can also modify/improve the template without requiring sysops to modify the CSS (and saving me some work, LOL). I have gone back to many of my earlier templates to add more functions over time, so making templates is not necessarily a 1-off exercise Gin-san (Talk) 12:35, April 24, 2010 (UTC)


 * The easy way is start by finding something similar & adapting it. Here is an event infobox template I copied from the wrestling wiki - As it started out and as it has evolved - current


 * It basically consists of repeating a std bit of code for each row and changing the label text and the parameter name (the bit that passes the datd tothe table that makes up the box from the page its used on).

! style= | Date held on
 * - class="hiddenStructure"
 * Date held on = the Label for the row
 * is the parameter for that row

Typical code used in the article to create the infobox is like this


 * which is then used in the article as | data1= with the data to be shown placed here were data1 is usually a short version of the label so the users can see what info goes on the line e.g date =    would indicate a date is required.


 * There are many other infobox templates that are similar but have slightly different ways of doing basically the same thing. This one if you add an extra row will show it in existing versions of the template used on pages, other versions suppress this. I left it working that was as older pages then show that the new line needs adding to the article it is used in.


 * Just have a go in your user space (add a link from your user page to User:yourname/infobox test for example then add a Infobox from the template wiki or another wiki with something that looks like what you need & start adjusting it & see what happens. As long as you retain the same data pareameters ( | parameter = ) you can replace it later with a new version without having to edit every article.


 * I like most users knew nothing about templates till i needed some for 'my' wiki - BulldozerD11 13:49, April 24, 2010 (UTC)