Widget Diskussion:Karte v2

Aus Guild Wars 2 Wiki
Zur Navigation springen Zur Suche springen

Smarty PHP error in wiki logs[Bearbeiten]

Similar to the issue I noted on Widget Diskussion:Karte, all of the input parameters need either defaults or checks to see if the parameters are set.

Problem

From the DE wiki logs:

Got error 'PHP message: PHP Notice:  Undefined index: polyline in /var/www/sites/gw2w-de/extensions/Widgets/compiled_templates/83fb76bd80479ca7c467117fade8d294b8b1ee49_0.wiki.Karte v2.php on line 56
PHP message: PHP Notice:  Trying to get property 'value' of non-object in /var/www/sites/gw2w-de/extensions/Widgets/compiled_templates/83fb76bd80479ca7c467117fade8d294b8b1ee49_0.wiki.Karte v2.php on line 56
PHP message: PHP Notice:  Undefined index: markers in /var/www/sites/gw2w-de/extensions/Widgets/compiled_templates/83fb76bd80479ca7c467117fade8d294b8b1ee49_0.wiki.Karte v2.php on line 58
PHP message: PHP Notice:  Trying to get property 'value' of non-object in /var/www/sites/gw2w-de/extensions/Widgets/compiled_templates/83fb76bd80479ca7c467117fade8d294b8b1ee49_0.wiki.Karte v2.php on line 58
Solution

Evidently the "markers" and "polyline" variables need defaults. Using empty quotes seems to be acceptable here.

I propose replacing the last div with the following:

<div class="gw2map-v2" 
	data-continent-id="<!--{$continent_id|validate:int|default:1}-->"
	data-floor-id="<!--{$floor_id|validate:int|default:1}-->"
	data-region-id="<!--{$region_id|validate:int|default:-1}-->"
	data-map-id="<!--{$map_id|validate:int|default:-1}-->"
	data-custom-floor="<!--{$custom_floor|validate:int|default:''}-->"
	data-language="<!--{$lang|validate:int|default:1}-->"
	data-zoom="<!--{$zoom|validate:int|default:5}-->"
	data-map-controls="<!--{$map_controls|validate:int|default:1}-->"
	data-linkbox="<!--{$linkbox|validate:int|default:0}-->"
	data-center-coords="<!--{$center_coords|regex_replace:"#[^,\d\s\[\]]#":""|default:''}-->"
	data-custom-rect="<!--{$custom_rect|regex_replace:"#[^,\d\s\[\]]#":""|default:''}-->"
	data-include-maps="<!--{$include_maps|regex_replace:"#[^,\d\s]#":""|default:''}-->"
	data-extra-layers="<!--{$extra_layers|regex_replace:"#[^a-z_,\s]#":""|default:''}-->"
	data-init-layers="<!--{$init_layers|regex_replace:"#[^a-z_,\s]#":""|default:''}-->"
	data-polyline="<!--{$polyline|regex_replace:"#[^a-z,;=\-\d\s]#":""}-->"
	data-markers="<!--{$markers|regex_replace:"#[^a-z,;=\-\d\s]#":""}-->"
	data-events="<!--{$events|validate:int|default:1}-->"
	data-tile-adjust="<!--{$tile_adjust|validate:int|default:0}-->"
></div>

--Chieftain Alex 20:35, 15. Apr. 2020 (CEST)