24/01/2015, 02:17:36
Ma solution :
1) ajouté un champ : CategoryExcluded
2) ajouter 2 fichiers dans lib\smarty\libs\plugins\compiler.continue.php et compiler.break.php
qui contient :
très utile pour continuer à l'item suivant de tableau ou bien sortir d'une boucle comme (C#)
dans mon gabarit du sommaire qui sert pour la page (pas le slide)
1) ajouté un champ : CategoryExcluded
2) ajouter 2 fichiers dans lib\smarty\libs\plugins\compiler.continue.php et compiler.break.php
qui contient :
Code :
[== PHP ==]
<?php
function smarty_compiler_break($contents, &$smarty){
return 'break;';
}
?>
//2eme fichier
<?php
function smarty_compiler_continue($contents, &$smarty){
return 'continue;';
}
?>
très utile pour continuer à l'item suivant de tableau ou bien sortir d'une boucle comme (C#)
dans mon gabarit du sommaire qui sert pour la page (pas le slide)
Code :
[== Indéfini ==]
...
{foreach from=$items item=entry}
{assign var='Isexclu' value=''} <!-- variable de sortie -->
{assign var='Category' value=$entry->category} <!-- categorie -->
{assign var='CategoryExcludedlist' value=$entry->fieldsbyname.CategoryExcluded->value}<!-- liste separe par ';' -->
{assign var='CategoryExcludedwords' value=';'|explode:$CategoryExcludedlist}<!-- creation du tableau des categories exclu.. -->
<!-- parcours la liste et si trouve sort de suite -->
{foreach from=$CategoryExcludedwords item=CategoryExcludedword}
{if $CategoryExcludedword == $Category}
{assign var='Isexclu' value=$Category}
{break}
{/if}
{/foreach}
<!-- Continue a l'item suivant car renseigne, une exclusion qui correspond a la categorie en cours -->
{if $Isexclu !=''}
{continue}
{/if}
...