Topic on Project:Support desk

Template Param Within Div

11
216.176.132.213 (talkcontribs)

I am using MediaWiki 1.24. I am brand new to MediaWiki but loving it so far but realize I have a lot to learn. I created a template which looks like this:


<div style="min-height: 32px; border-top: 1px solid #AAAAAA; border-right: 1px solid #AAAAAA; border-bottom: 1px solid #AAAAAA; border-left: 10px solid #3466A5; background-color: #fbfbfb; padding: 7px 7px 7px 15px;"><span style="float: left;"></span><pre style="margin-left: 15px; font-size: 120%; display: inline; border: 0; padding: 0;">{{{1}}}</pre></div>


However, the {{{1}}} param does not work and I read that the param cannot be between XML type tags. If that is the case, how would I write the above template so the param would work? I searched for an answer here first but was unable to find anything.

I am unable to provide a URL to my wiki because it is an internal IT knowledgebase which does not have external access.

Thanks in advance for input and advice!

FriedhelmW (talkcontribs)

What did you do? What happened? What did you expect to happen?

216.176.132.213 (talkcontribs)

The template is called mbox-console. When used like: Template:Mbox-console the sample text is not placed within the template. It remains {{{1}}} when displayed.

216.176.132.213 (talkcontribs)

Sorry that is { { mbox-console|This is the sample text. } } without the spaces between the brackets

FriedhelmW (talkcontribs)

When I replace pre by div it works.

121.220.99.147 (talkcontribs)

It's extension tags where variables don't work, not HTML tags. The reason it doesn't work is <pre> is actually an extension tag (which nowiki's the input before outputting the actual HTML pre tag).

You can use the {{#tag}} parser function to use pre (or any extension tag) with variables: {{#tag: pre | {{{1}}} | style = color:red }}

Another way is to put an empty HTML comment right after the word pre (<pre<!----> style="color:red">{{{1}}}</pre>), which tricks the parser into ignoring it as a extension tag and instead output it at as a normal HTML element, but it's a bit of a hack really.

216.176.132.213 (talkcontribs)

Thank you so much for the input. Like I said, I'm new and learning and I appreciate your feedback.

Karl Gruber (talkcontribs)
FriedhelmW (talkcontribs)

Try {{#tag: slippymap || lat="{{Gdekoord-Nord|Hinterbrühl}}" lon="{{Gdekoord-1Ost|Hinterbrühl}}" z="15" w="360" h="360" layer="Mapnik" marker="0"}}

Karl Gruber (talkcontribs)

Unfortunately, it doesn't work - The twice bar and 1Ost are these type mismatches? But I try it whithout there two, but alsoo without success :-(

121.220.99.147 (talkcontribs)

Because that's not how you use parser functions. They're in the format of key=value|key2=value2, not key="value" key2="value2", that's HTML attribute format. That example is putting "{{Gdekoord-Nord|Hinterbrühl}}" lon="{{Gdekoord-1Ost|Hinterbrühl}}" z="15" w="360" h="360" layer="Mapnik" marker="0" as the value for lat.

Use {{#tag: slippymap || lat={{Gdekoord-Nord|Hinterbrühl}} | lon={{Gdekoord-1Ost|Hinterbrühl}} | z=15 | w=360 | h=360 | layer=Mapnik | marker=0 }}

Reply to "Template Param Within Div"