Widget talk:Carte interactive

De Guild Wars 2 Wiki
Aller à la navigation Aller à la recherche

Smarty PHP errors[modifier]

Last one I promise.

Problem
Got error 'PHP message: PHP Notice:  Undefined index: indice in /var/www/sites/gw2w-fr/extensions/Widgets/compiled_templates/67342299857b04a83478a81e1435124b7e2e6d8c_0.wiki.Carte interactive.php on line 25
PHP message: PHP Notice:  Trying to get property 'value' of non-object in /var/www/sites/gw2w-fr/extensions/Widgets/compiled_templates/67342299857b04a83478a81e1435124b7e2e6d8c_0.wiki.Carte interactive.php on line 25
PHP message: PHP Notice:  Undefined index: indice in /var/www/sites/gw2w-fr/extensions/Widgets/compiled_templates/67342299857b04a83478a81e1435124b7e2e6d8c_0.wiki.Carte interactive.php on line 1442
PHP message: PHP Notice:  Trying to get property 'value' of non-object in /var/www/sites/gw2w-fr/extensions/Widgets/compiled_templates/67342299857b04a83478a81e1435124b7e2e6d8c_0.wiki.Carte interactive.php on line 1442'
Solution

Add validation to the "indice" and "format" parameters. This one is too big to paste the entire code on the talk page, so here's two segments.

Near the top

<div class="mapWidget" id="map<!--{$indice|escape|validate:int|default:1}-->" style="margin : auto;<!--{if isset($format) && $format ==='monde'}-->max-height: 800px;<!--{/if}-->"></div>

Near the end

		var carteInteractive<!--{$indice|escape|validate:int|default:1}--> = new CarteInteractive(format, zone, cible, indice);

-Chieftain Alex (discussion) 15 avril 2020 à 19:57 (CEST)

Also could fix the link to MediaWiki:Carte interactive/Données in the documentation.
For bonus points, Special:ChangeContentModel could be used to set "MediaWiki:Carte interactive/Données" to javascript so that it formats like common.js etc. -Chieftain Alex (discussion) 15 avril 2020 à 20:00 (CEST)