Forum:Multiple templates in DPL

Hey,

I'm one of the Admins at w:c:Wakfu.

After a discussion with one of our members, I wanted to start using DPL on the site to generates some sortable tables of things. The problem is, most of the pages consist of multiple small templates, and my current level of DPL just about grasps the ability to handle one template in each article.

So, I was wondering if it was possible to select a take information from multiple templates in each article, put that information all in the same table row (so when you sort each column, the information from a single article stays together, etc)?

The member I was talking to, who came from the w:c:Dofus wiki, was basically saying we need a single giant template to cover everything that you'd want to call up with a single DPL table, but I was hoping DPL was flexible enough that the current templates/articles could be left untouched, and editing a page could be left as simple templates, rather than a giant wrapper-template generating the small ones (i.e. I don't want to trade a simplicity in editing for DPL functionality).

An example article: Ash Bow which uses:
 * The "Itembox" template which contains simple things which apply to every item in the game
 * The "EffectStub" template which contains the effect of the item when held/worn.
 * The "Attack bow" template which contains the effect of the bow's attack.
 * and the "Craftbox" template which contains the information about crafting the item.

What I have so far:
 * The Bow article, with a table of the 2 bows on the wiki, showing just the information pulled from the "Itembox" template. (lists the item's name, level, and description)
 * The "Infobox Weapon.Table" Template (there is some old info/code which I've left in the non-code part of this template so I can take ideas from it.. but it actually generates the basic table shown on the "Bow" page).
 * The "Itembox.TableRow" Template which fills the rows, with data taken from the "Itembox" on each article.

An example of what I'd like to be able to do:
 * On the general Bow page: a table showing each item's name, level, passive effects, attack effects, and if there's a craft template present (i.e. is it craftable)... without changing/adding any more templates/wrapper templates to the "Ash Bow" page.

Hopefully, I've made it clear what I'm trying to do.

Thank you for your time, and any help you can give me --Defunc7 15:11, May 4, 2011 (UTC)


 * Because you're using a surrogate template which you also use to format table rows, I don't see a way to derive data from more than on template without causing the output table to break, with that dpl structure. However, you could just call various template parameters 'manually' and replace the hard-coded table tags with the  dpl parameter. That would certainly make the table more flexible. From there you would have more options on how to proceed including a new surrogate template to allow more complicated queries. On my user page, I've created an example list showing how I would tackle the problem.


 * Regardless of how you proceed, the articles that you're about to include in the dpl need to be standardized to make it work. Sovq 16:06, May 4, 2011 (UTC)


 * I looked at your example, and it really helped me move forward. I also tweaked my original attempt (I also tried mixing Bows and Wands to test how I could expand it).


 * Following your example, I made DPL Table, and my original version Template:Infobox_Weapon.Table... I prefer your version since it since much easier to work with (rather than multiple templates every time I want a different looking table), and I get less errors (which I'm not sure how to "handle" either)... but I've hit two issues.


 * 1. I can set the individual table cells as valign=top but not the first column with the article name/link. I would normally do it by applying the attribute to the table row... but I can't work out how.


 * 2. Items can be either "crafted", "loot", or "prizes"... I was hoping to check to see if the page has the specific template in use, and then display an icon/letter depending on which. Is there any way to test that in the DPL structure to get this sort of result, or would I have to put a template on the page which wraps all three of those options (so I can simply read in the value saying which one it is, and then show the appropriate icon)... I'm not sure if that's what you meant by "standardized articles".


 * Thanks again --Defunc7 22:36, May 4, 2011 (UTC)


 * What you can do is add the information into the main template on the page, whether the template uses that information or not. This allows you to access that information with the include. Rappy 00:07, May 5, 2011 (UTC)


 * 1. I have suggested removing all the  tags and do the formatting using   and   dpl parameters, bacause that would make your table(s) more consistent in appearance and you could certainly avoid issues like the valign="top" one. I See the article titles aligned to the top so I guess you've solved that problem.


 * 2. I'm not sure where the "crafted", "loot", or "prizes" info can be found, as I'm not seeing it on the pages, but if it's stored as a template paramter then you can use the includematch dpl parameter. If the type of template itself is defining what type of item it is, then you probably could use regular #if parser function in the surrogate templates to call the data. But to be able to answer that question throughly, I would need to know where that info is stored. Sovq 08:27, May 5, 2011 (UTC)


 * From what I understood reading this, that if an item is craftable, it has an additional template on the page to show this information. If Defunc7 added the crafting information to the main template, he can access that information with the DPL query on the page with that template... whether or not that template does anything with those parameters or not. I do this quite often when dealing with DPL because of this limitation. The only way around it is to nest DPL calls in the main DPL query which is quite intensive on the servers and will be slow to load most tables. Rappy 18:39, May 5, 2011 (UTC)


 * In fact, looking at Ash Bow now, I can see that if all of these headers follow the same way... you can simply mesh all 4 templates into one to fill the page. Alternatively, you'd end up listing the information twice. Once in Itembox and again in Effectbox, Craftbox, etc... In other words, if you want to change nothing with your current way, simply add the information from the other templates into Itembox and use that for your DPL include. Something like...


 * then you can access all that information with one DPL query on Itembox. Itembox can still only parse what you've told it to parse without any problems. My other suggestion would be to do the itembox like above, and have the itembox call the additional templates Effectbox, craftbox, etc, with the information shown above if they exist. Rappy 18:47, May 5, 2011 (UTC)