Forums: Index Support Requests Need help figuring out a template/parser function problem
Fandom's forums are a place for the community to help other members.
To contact staff directly or to report bugs, please use Special:Contact.

50px-Replacement filing cabinet.svg

Note: This topic has been unedited for 1660 days. It is considered archived - the discussion is over. Do not add to unless it really needs a response.

I spent a couple of hours today trying to make this template automatically create links for parameters 1, 2, and 3. I couldn't find anything that said you can't put [[ and ]] inside the {{#if}} function, but it always output something that looked like this:

  • [[Hart Hills


    • [[Hawklor


instead of:

  • Hart Hills
    • Hawklor

The only explanation I could think of was that it's somehow including a line break as part of the parameters. If so, why? Or is there something else I'm missing? Thanks! Psychoadept (talk) 06:28, August 1, 2012 (UTC)

I don't understand what the problem is?
{{#if:1|*Hart Hills
  • Hart Hills
    • Hawklor
which looks fine to me. Is what you're trying to do different / more complex than this? If so, please post the exact snippet of code that you tried (not the entire template code -- just the small part that's causing the problem). 20px_Rin_Tohsaka_Avatar.png Mathmagician ƒ(♫) 06:43 UTC, Wed, 01 August 2012
Here's the code in question (the first layer of the list is a required parameter, included just prior to this):
{{#if:{{{1|}}}|** {{{1}}} }}
{{#if:{{{2|}}}|*** {{{2}}} }}
{{#if:{{{3|}}}|**** {{{3}}} }}
What I tried that didn't work was this:
{{#if:{{{1|}}}|** [[{{{1}}}]] }}
{{#if:{{{2|}}}|*** [[{{{2}}}]] }}
{{#if:{{{3|}}}|**** [[{{{3}}}]] }}
Psychoadept (talk) 07:12, August 1, 2012 (UTC)
Syrth Westwold
Sorry, just to verify, can you also link me to a page that uses this template where it's not working properly? As far as I can tell, your template appears to be working just fine. For example, on your w:c:sryth:Westwold page, I am seeing this.
Edit: I've finished doing a bit more tinkering now. Check out ~Hart Hills~@ and ~Hart Hills~@, these might be able to help you figure out the linebreak issue. In particular, my Test3 template makes use of wikipedia:Template:Trim, which is used for trimming whitespace in templates. 20px_Rin_Tohsaka_Avatar.png Mathmagician ƒ(♫) 08:02 UTC, Wed, 01 August 2012
Fantastic, thanks! That trim template is exactly what I needed. For organizational clarity, it's best if I can keep the separate lines. Psychoadept (talk) 14:58, August 1, 2012 (UTC)
Okay, I imported wikipedia:Template:Trim and it's working, but the [[ and ]] are still rendering as text instead of creating a link. As far as I can tell I've copied your code exactly. Psychoadept (talk) 15:10, August 1, 2012 (UTC)
Fixed Trim, also this edit was mine but I forgot to login. Everything seems to be working now? 20px_Rin_Tohsaka_Avatar.png Mathmagician ƒ(♫) 16:11 UTC, Wed, 01 August 2012
Looks great, thanks again! Psychoadept (talk) 16:34, August 1, 2012 (UTC)
Community content is available under CC-BY-SA unless otherwise noted.