[spip-dev] speciale Compilo pour la 4

Hello,

Bon, j'ai un problème avec une boucle de ce genre :

<BOUCLE_promolst_tmp(promotions promotions_art){SUBSTR(promotions_ua_id, (#EVAL{_BROWSERTYPE}), 1)==1} >
     #PROMOTION_LIBELLE
</BOUCLE_promolst_tmp>

si je fais :

<BOUCLE_promolst_tmp(promotions promotions_art){SUBSTR(promotions_ua_id, 4, 1)==1} >
     #PROMOTION_LIBELLE
</BOUCLE_promolst_tmp>

tout va bien. mais la 1e syntaxe me renvoie une erreur : Critère inconnu SUBSTR

J'imagine que soit au moment ou la boucle s'exécute, #EVAL n'est pas encore évalué. Soit la syntaxe déplait au compilo. Bien sur, _BROWSERTYPE est renseigné mais du coup, je ne vois pas comment faire.

ESJ, si tu as une idée, parait qu'il faut voir avec toi... :slight_smile:

Chag

Personne n'a d'idée pour ce problème ?

Chag

Un grand merci a denisb qui a resolu ce probleme de fort belle maniere :

[(#EVAL{_BROWSERTYPE}|=={1}|oui)
   #SET{reg, ^#EVAL{_BROWSERTYPE}}]
[(#EVAL{_BROWSERTYPE}|=={1}|non)
   #SET{reg, ^.{#EVAL{_BROWSERTYPE}|moins{1}|concat{'}1'}}]

<BOUCLE_promolst(promotions_art promotions){promotion_target == #GET{reg}}>

Chag

un immenssissime merci à _renato_ qui l'a simplifié de bien plus belle
manière encore :

#SET{reg, #VAL{.}|str_repeat{#EVAL{_BROWSERTYPE}|moins{1}}}
<BOUCLE_p(promotions_art promotions) {promotion_target == ^#GET{reg}1}>

sans oublier (où avais-je la tête ?) le *remarquable* travail de kent1
sur les listes !

(évident certes, mais ça va mieux en disant)