Jump to content

User:Borgx/Incorrect result of ParserFunctions at local wiki

From Wikipedia, the free encyclopedia

Incorrect result of ParserFunctions at local wiki

[edit]

Could someone help me please. My local wiki (1.7 r13859, php 5.1.2, (apache2handler), apache 2.0.55 windows, mysql 5.0.17-nt) failed to display the proper result when using {{#if:}} (see this (slow connection)) and compare it to same page on test.wikipedia.org. Am I missing something?

The template:

{| border="1"
|name||{{{name}}}
|-
|address||{{{address}}}
|-
|phone||{{{phone}}}
{{#if:{{{city|}}}|<tr><td>city</td><td>{{{city}}}</td></tr>}}
|}


The page:

{{tes|name=Robert|address=Street|phone=987665|city=Bangkok}}

The result:

wrong result at local
correct result at test.wikipedia

Thanks borgx (talk) 07:04, 26 April 2006 (UTC)

I'd say that the 3rd <tr> isn't being closed. Check the template. --SheeEttin 19:29, 26 April 2006 (UTC)
Note that the same code works correctly on test.wikipedia (second image) borgx (talk) 23:43, 26 April 2006 (UTC)

Note that the Wikimedia mediawiki installations generally post-process content with htmltidy (there's an option for that in localsettings) which would heal defective html markup. I'm guessing your local install isn't doing that tidying. But as SheeEttin notes, the underlying cause is that something is generating bad html in the first place. -- Finlay McWalter | Talk 11:54, 27 April 2006 (UTC)

After days of madness search and reinstalling, it appears that key to this problem is the missing parameter $wgUseTidy=true; (it has "false" as default value). Perhaps we shall propose this parameter to be "true" as default. Thanks to Finlay McWalter for his hint. borgx (talk) 00:05, 28 April 2006 (UTC)
Designing your template in a way working without tidy-fixup is a good plan. You could try to insert |- before the {{#if:, that should close any pending <tr> of a previous row. You could also put the "missing" </tr> into the conditional row, but that's an odd strategy (if it works at all).
The WP:QIF example 2a is for the first row where |- is optional, no incomplete row before it. Maybe swap foo and bar everywhere in this example to demonstrate your "no-tidy effect" in WP:QIF. -- Omniplex 16:19, 1 May 2006 (UTC)

How wonderful! The templat code now:

{| border="1"
|name||{{{name}}}
|-
|address||{{{address}}}
|-
|phone||{{{phone}}}
{{#if:{{{city}}}|{{!}}-
{{!}}{{!}}city{{!}}{{!}}{{{city}}}}}
|-
|}

Thanks borgx (talk) 03:31, 22 September 2006 (UTC)