Widget talk:YouTube

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

PHP smarty error[modifier]

Problem

From the wiki logs, there's the following entry:

Got error 'PHP message: PHP Notice:  Undefined index: start in /var/www/sites/gw2w-fr/extensions/Widgets/compiled_templates/72f364fa062833606df22e2689003517b15a0a7a_0.wiki.YouTube.php on line 29
PHP message: PHP Notice:  Trying to get property 'value' of non-object in /var/www/sites/gw2w-fr/extensions/Widgets/compiled_templates/72f364fa062833606df22e2689003517b15a0a7a_0.wiki.YouTube.php on line 29'

Previewing it on my test wiki also reveals the "id" parameter has a similar issue.

Solution

Add a default (and optionally an escape) to the "start" and "id" parameters.

Since it's a short widget, I'll propose the entire widget code:

<includeonly><iframe width="<!--{$width|escape:'html'|default:'420'}-->" height="<!--{$height|escape:'html'|default:350}-->" src="https://www.youtube.com/embed/<!--{if isset($playlist)}-->?listType=playlist&list=<!--{$playlist|escape:'urlpathinfo'|default:''}--><!--{else}--><!--{$id|escape:'urlpathinfo'|default:''}-->?start=<!--{$start|escape:'urlpathinfo'|default:''}--><!--{/if}-->" frameborder="0" allowfullscreen></iframe></includeonly><noinclude>Widget pour l'affichage d'une vidéo YouTube de la chaîne officielle Guild Wars 2 ou de la chaîne de Guild Wars 2 Wiki FR. Voir le [[Modèle:YouTube]] pour utilisation. [[Catégorie:Widgets]]</noinclude>

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