Foster Posted October 11, 2012 Share Posted October 11, 2012 (edited) Bonjour, comme le suppose mon titre, je souhaiterais savoir comment attribuer 3 couleurs différentes en fonction des titres de mes catégories, j'ai beau chercher sur le forum mais je ne trouve rien, quelqu'un aurait une idée ? Merci. Edited October 11, 2012 by Foster (see edit history) Link to comment Share on other sites More sharing options...
franckm1000 Posted October 11, 2012 Share Posted October 11, 2012 (edited) Dans le fichier category.tpl où il y a <h1> . Si tu connais l'ID de chaque catégorie tu templaces par: {if $category->id==x} <h1 style="color:#..."> {elseif $category->id==y} <h1 style="color:#..."> {elseif $category->id==z} <h1 style="color:#..."> {/if} où x,y et z sont les ID des catégories. Edited October 11, 2012 by franckm1000 (see edit history) Link to comment Share on other sites More sharing options...
Foster Posted October 12, 2012 Author Share Posted October 12, 2012 (edited) Super ! Merci à toi prestashop je vais essayer ça. Edited October 12, 2012 by Foster (see edit history) Link to comment Share on other sites More sharing options...
Foster Posted October 12, 2012 Author Share Posted October 12, 2012 J'ai essayé comme ça mais ça ne marche pas, qu'en penses tu ? Merci. {include file="$tpl_dir./breadcrumb.tpl"} {include file="$tpl_dir./errors.tpl"} {if isset($category)} {if $category->id AND $category->active} <h1>{if $category->id==5} <h1 style="color:#000000"> {elseif $category->id==6} <h1 style="color:#000000"> {elseif $category->id==7} <h1 style="color:#000000"> {/if} </h1> Link to comment Share on other sites More sharing options...
franckm1000 Posted October 12, 2012 Share Posted October 12, 2012 (edited) Euh ok mais là tu mets la même couleur aux 3 donc comment voir si ça marche ? En plus tes h1 sont mal imbriqués. Essaies plutôt: {include file="$tpl_dir./breadcrumb.tpl"}{include file="$tpl_dir./errors.tpl"}{if $category->id==5}<h1 style="color:#000">ton texte titre</h1>{elseif $category->id==6}<h1 style="color:#fff">ton texte titre</h1>{elseif $category->id==7}<h1 style="color:#ccc">ton texte titre</h1>{/if} Edited October 12, 2012 by franckm1000 (see edit history) Link to comment Share on other sites More sharing options...
Foster Posted October 12, 2012 Author Share Posted October 12, 2012 Ok merci presta, j'ai essayé mais (voir capture) ça ne change pas la couleur au bon endroit moi je voudrais juste changer la couleur des titres catégories dans la colonne de gauche. Link to comment Share on other sites More sharing options...
TiBaker Posted October 12, 2012 Share Posted October 12, 2012 Je pose ma question ici puisque c'est à peut pret le même problème que je rencontre... J'aimerais crée plusieurs univers sur un site sous presta... 1.5.X, et chaque univers j'aimerais atribué une couleur unique. Exemple : univers : informatique -> couleur bleu, univers electroménager -> couleur orange. Tous le site dois changé de couleur... Biensure si j'utilise le module Advenced Menu Top je pourrais géré les diférrents couleur mais c'est pour le site globale j'aimerais savoir si il n'existe pas un module ou si je suis obliger passer par une condition mentionné dans les postes au dessus : {if $category->id==5} <link href="/lokaf-collection/themes/lokaf-collection/css/global-bleu.css" rel="stylesheet" type="text/css" media="all" /> {elseif $category->id==6} <link href="/lokaf-collection/themes/lokaf-collection/css/global-orange.css" rel="stylesheet" type="text/css" media="all" /> {/if} Link to comment Share on other sites More sharing options...
TiBaker Posted October 12, 2012 Share Posted October 12, 2012 {if $category->id==5} <link href="/lokaf-collection/themes/lokaf-collection/css/global-bleu.css" rel="stylesheet" type="text/css" media="all" /> {elseif $category->id==7} <link href="/lokaf-collection/themes/lokaf-collection/css/global-orange.css" rel="stylesheet" type="text/css" media="all" /> {/if} Link to comment Share on other sites More sharing options...
TiBaker Posted October 12, 2012 Share Posted October 12, 2012 J'écris en Français parce-que ça passe pas dans le texte area du forume lol Si je suis sur la catégorie (univers) informatique, le site s'affiche en bleu Sinon si le site est sur la catégorie (univers) electromenager, le site s'affiche en orange On ferme la condition.... Link to comment Share on other sites More sharing options...
franckm1000 Posted October 12, 2012 Share Posted October 12, 2012 Eh bien soit un peu plus précis alors ! le 'titre des catégories' il aurait plutôt fallu dire le titre des catégories DU MENU non ? Là il est trop tard, à demain... Link to comment Share on other sites More sharing options...
Foster Posted October 13, 2012 Author Share Posted October 13, 2012 Autant pour moi presta Link to comment Share on other sites More sharing options...
Foster Posted October 15, 2012 Author Share Posted October 15, 2012 Quelqu'un aurait une idée ? Merci. Link to comment Share on other sites More sharing options...
franckm1000 Posted October 15, 2012 Share Posted October 15, 2012 De la même facçon que je t'ai montré mais avec le module qui gère l'affichage des catégories sur la droite. fichier : modules/blockcategories/category-tree-branch.tpl Tu remplaces: <a href="{$node.link}" {if isset($currentCategoryId) && ($node.id == $currentCategoryId)}class="selected"{/if} title="{$node.desc|escape:html:'UTF-8'}">{$node.name|escape:html:'UTF-8'}</a> Par: {if $category->id==5} <a href="{$node.link}" style="color:#000;" {if isset($currentCategoryId) && ($node.id == $currentCategoryId)}class="selected"{/if} title="{$node.desc|escape:html:'UTF-8'}">{$node.name|escape:html:'UTF-8'}</a> {elseif $category->id==6} <a href="{$node.link}" style="color:#fff;" {if isset($currentCategoryId) && ($node.id == $currentCategoryId)}class="selected"{/if} title="{$node.desc|escape:html:'UTF-8'}">{$node.name|escape:html:'UTF-8'}</a> {if $category->id==7} <a href="{$node.link}" style="color:#ccc;" {if isset($currentCategoryId) && ($node.id == $currentCategoryId)}class="selected"{/if} title="{$node.desc|escape:html:'UTF-8'}">{$node.name|escape:html:'UTF-8'}</a> {/if} Link to comment Share on other sites More sharing options...
Foster Posted October 15, 2012 Author Share Posted October 15, 2012 Merci j'ai essayé mais ça ne donne rien, voici mon code : <li {if isset($last) && $last == 'true'}class="last"{/if}> {elseif $category->id==5} <a href="{$node.link}" style="color:#000;" {if isset($currentCategoryId) && ($node.id == $currentCategoryId)}class="selected"{/if} title="{$node.desc|escape:html:'UTF-8'}">{$node.name|escape:html:'UTF-8'}</a> {if $category->id==6} <a href="{$node.link}" style="color:#fff;" {if isset($currentCategoryId) && ($node.id == $currentCategoryId)}class="selected"{/if} title="{$node.desc|escape:html:'UTF-8'}">{$node.name|escape:html:'UTF-8'}</a> {if $category->id==23} <a href="{$node.link}" style="color:#ccc;" {if isset($currentCategoryId) && ($node.id == $currentCategoryId)}class="selected"{/if} title="{$node.desc|escape:html:'UTF-8'}">{$node.name|escape:html:'UTF-8'}</a> {if $category->id==7} <a href="{$node.link}" style="color:#000;" {if isset($currentCategoryId) && ($node.id == $currentCategoryId)}class="selected"{/if} title="{$node.desc|escape:html:'UTF-8'}">{$node.name|escape:html:'UTF-8'}</a> {/if} {if $node.children|@count > 0} <ul> {foreach from=$node.children item=child name=categoryTreeBranch} {if $smarty.foreach.categoryTreeBranch.last} {include file="$tpl_dir./category-tree-branch.tpl" node=$child last='true'} {else} {include file="$tpl_dir./category-tree-branch.tpl" node=$child last='false'} {/if} {/foreach} </ul> {/if} Link to comment Share on other sites More sharing options...
franckm1000 Posted October 15, 2012 Share Posted October 15, 2012 Le code que tu as mis ne veut rien dire et est blindé d'erreurs dans tes boucles ! Je me rends compte que je me suis trompé sur un if. Mais comprends la démarche du if: {j'ouvre if}première condition {elseif si autre condition}deuxième condition {elseif si autre condition} troisième condition... ... {elseif dernière condition}dernière condition {/if je ferme le if} Le code est: {if $category->id==5} <a href="{$node.link}" style="color:#000;" {if isset($currentCategoryId) && ($node.id == $currentCategoryId)}class="selected"{/if} title="{$node.desc|escape:html:'UTF-8'}">{$node.name|escape:html:'UTF-8'}</a> {elseif $category->id==6} <a href="{$node.link}" style="color:#fff;" {if isset($currentCategoryId) && ($node.id == $currentCategoryId)}class="selected"{/if} title="{$node.desc|escape:html:'UTF-8'}">{$node.name|escape:html:'UTF-8'}</a> {elseif $category->id==23} <a href="{$node.link}" style="color:#ccc;" {if isset($currentCategoryId) && ($node.id == $currentCategoryId)}class="selected"{/if} title="{$node.desc|escape:html:'UTF-8'}">{$node.name|escape:html:'UTF-8'}</a> {elseif $category->id==7} <a href="{$node.link}" style="color:#000;" {if isset($currentCategoryId) && ($node.id == $currentCategoryId)}class="selected"{/if} title="{$node.desc|escape:html:'UTF-8'}">{$node.name|escape:html:'UTF-8'}</a> {/if} Link to comment Share on other sites More sharing options...
Foster Posted October 16, 2012 Author Share Posted October 16, 2012 Merci beaucoup pour tes explications , par contre malgré les modifications c'est toujours de la même couleur : <li {if isset($last) && $last == 'true'}class="last"{/if}> {if $category->id==5} <a href="{$node.link}" style="color:#000;" {if isset($currentCategoryId) && ($node.id == $currentCategoryId)}class="selected"{/if} title="{$node.desc|escape:html:'UTF-8'}">{$node.name|escape:html:'UTF-8'}</a> {elseif $category->id==6} <a href="{$node.link}" style="color:#fff;" {if isset($currentCategoryId) && ($node.id == $currentCategoryId)}class="selected"{/if} title="{$node.desc|escape:html:'UTF-8'}">{$node.name|escape:html:'UTF-8'}</a> {elseif $category->id==23} <a href="{$node.link}" style="color:#ccc;" {if isset($currentCategoryId) && ($node.id == $currentCategoryId)}class="selected"{/if} title="{$node.desc|escape:html:'UTF-8'}">{$node.name|escape:html:'UTF-8'}</a> {elseif $category->id==7} <a href="{$node.link}" style="color:#000;" {if isset($currentCategoryId) && ($node.id == $currentCategoryId)}class="selected"{/if} title="{$node.desc|escape:html:'UTF-8'}">{$node.name|escape:html:'UTF-8'}</a> {/if} {if $node.children|@count > 0} <ul> {foreach from=$node.children item=child name=categoryTreeBranch} {if $smarty.foreach.categoryTreeBranch.last} {include file="$tpl_dir./category-tree-branch.tpl" node=$child last='true'} {else} {include file="$tpl_dir./category-tree-branch.tpl" node=$child last='false'} {/if} {/foreach} </ul> {/if} Link to comment Share on other sites More sharing options...
Foster Posted October 18, 2012 Author Share Posted October 18, 2012 Je n'y arrive toujours pas, aurais je mal placé une balise ? Merci. Link to comment Share on other sites More sharing options...
Foster Posted October 18, 2012 Author Share Posted October 18, 2012 Quelqu'un aurait une idée ? Link to comment Share on other sites More sharing options...
Foster Posted October 23, 2012 Author Share Posted October 23, 2012 Personne ? Merci. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now