Sujet fermé
Note de ce sujet :
  • Moyenne : 0 (0 vote(s))
  • 1
  • 2
  • 3
  • 4
  • 5

[RESOLU] Ne pas afficher certains sommaires de NEWS
#9

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 :
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}    
...
Sujet fermé


Messages dans ce sujet

Atteindre :


Utilisateur(s) parcourant ce sujet : 1 visiteur(s)