New engineering items

Fragment of a discussion from User talk:Lorak990
Jump to: navigation, search

I can always be contacted for anything, but Lorak is most likely best to start with for LotS.

Basically if you post on either of our pages, or admin discussion forum, you are going to get about 10 responses. At least me personally I help because I like it. I might trail off into the technical, like I am about to do, but enjoy!

So the technical methodology behind Plujan's suggestion/change is this:

  • So the wiki parses is going along and it encounters something to parse such as a parse function, and it starts parsing it and running code.
  • Lets say you wanted to display a lot of attributes in a template based on positional parameters that one must be there for the next to appear and so on
    • Exmaple: {{LotS/Template|100|300|400}}
  • If Lots/Template takes 20 or 30 such positional parameters, then normally if the conditional parsing in the Template page took 1 parser function for each positional parameter, then it would take 20 or 30 parser function calls every time the template is used.
    • This is a problem if the template is used on other pages such as item list pages have 500 items and call it 1000 to 1500 times. Quickly makes pages load slow.
  • Now let's say we did what Plujan suggested
  • Instead of displaying calling the functions every time we only call the next if the previous positional parameter was used.
    • So in our example we are actually using 4 calls to the #if parser function.
    • {{LotS/Template|100|300|400}}
  • On the 4th call to the the #if parser function, it sees that there is no 4th positional parameter, and stops parsing.

Now we generalize the solution usually when doing this so it is outputting say a table row so that it can be used on just about any table of similar data such as guns and swords or something along those lines. Now it just works and the complicated-ness is dispelled, and some craziness ensues in a thread.

Zoycite (talk)08:56, 30 August 2013

Yeah, I was mostly doing to solve the new row problem (as was already accurately described upthread), and I realized that this would also have a performance benefit, so double win!

Speaking of which, I noticed that there are a few cases where a template has something like {{#if: {{{2|}}} | {{{2}}} | {{{1}}}}} It seems to me that in this case it would be simpler and cleaner to just write {{{2|{{{1}}}}}} Is there a compelling reason to not use the second form? I've made this change in a few of the LoH templates where I've noticed it can be done, but I wanted to make sure there's not something I'm missing...

Plujan (talk)07:50, 31 August 2013

we just tend to use the explicit form, rather than the short cut

Zoycite (talk)08:34, 31 August 2013

The problem with {{{2|{{{1}}}}}} is that if 2 if specified but blank, it will still be used, whereas #if won't use it if it is only whitespace. Which one is better, if either, depends on the situation.

Bobogoobo (talk)11:06, 31 August 2013

ah yeah valid point, for item card pages it is usually not a big deal.

it will be a problem if the variable is specified without a value in a template.


Zoycite (talk)21:13, 2 September 2013