- 0 Talk
Cgmv123/TemplateCoding
< Cgmv123
After the Wikia move, several of our expensive templates suddenly stopped working after so many calls on a page. This is an attempt to raise the limit to where we hopefully will never run into any issues. Note: documentation coding has been removed for simplicity's sake. These changes, in theory, would allow Template:ep to be called an unlimited number of times and Template:crossref to be called ~350 times as opposed to the current limit of ~175. (With the present coding, #ifexist is called twice for episodes, with this new coding, it is only called once.)
Contents |
Template:Ep
Edit
Current Code
Edit
<includeonly>"{{#ifexist:Template:Ep/{{{1|}}}|{{#if:{{{bold|}}}|'''}}[[{{Template:Ep/{{{1|}}}|a }}|<span title=
"{{Template:Ep/{{{1|}}}}} (episode: {{{1|}}})">{{ Template:Ep/{{{1|}}} }}</span>]]{{#if:{{{bold|}}}|'''|{{{2|}}}}}}}"</includeonly>
Proposed Idea
Edit
<includeonly>"{{#if:{{{bold|}}}|'''}}{{if:{{{link|}}}||[[}}{{Template:Ep/{{{1|}}}|a }}|<span title="{{Template:Ep/{{{1|}}}}}
(episode: {{{1|}}})">{{ Template:Ep/{{{1|}}} }}</span>{{if:{{{link|}}}||]]}}{{#if:{{{bold|}}}|'''|{{{2|}}}}}}}"</includeonly>
Changes
Edit
Removed #ifexist function at beginning, if you're calling this template, you know which episode you're going to call. Also added link parameter, so using link=0 does not generate a link.
Template:Crossref
Edit
Current Code
Edit
<includeonly><small>{{#if:{{{1|}}}|({{Crossref link|{{{1}}}}})}}{{
#if:{{{2|}}}| ({{Crossref link|{{{2}}}}})}}{{
#if:{{{3|}}}| ({{Crossref link|{{{3}}}}})}}</small></includeonly>
Proposed Code
Edit
<includeonly><small>({{Crossref link|{{{1}}}}}){{
#if:{{{2|}}}| ({{Crossref link|{{{2}}}}})}}{{
#if:{{{3|}}}| ({{Crossref link|{{{3}}}}})}}</small></includeonly>
Changes
Edit
Removed #if function at beginning, because if you're calling the template, you want at least one crossref.
Template:Crossref link
Edit
Current Code
Edit
<includeonly>{{#ifexist:template:ep/{{{1}}}
|{{ep|{{{1}}}}}
|{{#ifexist:template:mag/{{{1}}}
|{{mag|{{{1}}}}}
|{{#ifexist:{{{1}}}
|{{#switch:{{{1|}}}|promo=[[Still photography|promotional still]]|#default=[[{{{1}}}]]}}
|[[wikipedia:{{{1}}}|{{{1}}}]]
}}
}}
}}</includeonly>
Proposed code
Edit
<includeonly>{{#ifexist:template:ep/{{{1}}}
|{{ep|{{{1}}}}}
|{{#ifexist:template:mag/{{{1}}}
|{{mag|{{{1}}}}}
|{{#switch:{{{1|}}}|promo=[[Still photography|promotional still]]|#default=[[{{{1}}}]]}}
|[[{{{1}}}]]
}}
}}
}}</includeonly>
Changes
Edit
Made default to Lostpedia articles. Wikipedia articles could still be referenced by {{crossref|wikipedia:ARTICLENAME}} In theory if we overrun our count, it will still display XxXX which would link to the appropriate article.