VL10 Posted February 17, 2014 Share Posted February 17, 2014 Bonjour à tous, J'ai regardé sur tous les forums, sur internet ect et je n'ai pas trouvé. Je voudrais changer de Background pour chacune de mes pages CMS. Il n'y a pas de page CSS pour les pages CMS. Juste l'éditeur HTML dans le back office. Si vous avez des idées ou des solutions, je suis preneur... merci à tous, Viktor Link to comment Share on other sites More sharing options...
Szed Posted February 17, 2014 Share Posted February 17, 2014 Pour cela il vous faut dans le header.tpl de votre thème, appliquez une classe au <body> en fonction de l'id de la page CMS (ca demande de récupérer l'id de la page CMS affichée via smarty). Et ensuite, tu applique en CSS un background différent selon la classe du body. Link to comment Share on other sites More sharing options...
VL10 Posted February 17, 2014 Author Share Posted February 17, 2014 Merci de votre réponse, pouvez-vous me donner un exemple s'il vous plait ? Link to comment Share on other sites More sharing options...
Szed Posted February 17, 2014 Share Posted February 17, 2014 (edited) Dans le header.tpl de votre thème, vous devriez avoir un truc comme ca : <body {if isset($page_name)}id="{$page_name|escape:'htmlall':'UTF-8'}"{/if} class="{if isset($page_name)}{$page_name|escape:'htmlall':'UTF-8'}{/if}{if $hide_left_column} hide-left-column{/if}{if $hide_right_column} hide-right-column{/if}{if $content_only} content_only{/if}"> On le remplace par (avec en bleu ce qu'il y a de nouveau) : <body {if isset($page_name)}id="{$page_name|escape:'htmlall':'UTF-8'}"{/if} class="{if isset($page_name)}{$page_name|escape:'htmlall':'UTF-8'}{/if}{if $hide_left_column} hide-left-column{/if}{if $hide_right_column} hide-right-column{/if}{if $content_only} content_only{/if} {if $isset($cms)}cms_{$cms.id}{/if}"> C'est possible que $cms.id ne marche pas, ca peut être autre chose (comme $cms->id peut être). Donc, selon la page CMS, le body aura par exemple la classe cms_1, cms_7, cms10 etc. Et dans votre CSS body.cms_1{background:url(image1);} body.cms_2{background:url(image2);} body.cms_3{background:url(image3);} body.cms_4{background:url(image4);} etc... Edited February 17, 2014 by Szed (see edit history) 1 Link to comment Share on other sites More sharing options...
VL10 Posted February 17, 2014 Author Share Posted February 17, 2014 <body {if isset($page_name)}id="{$page_name|escape:'htmlall':'UTF-8'}"{/if} class="{if $hide_left_column}hide-left-column{/if} {if $hide_right_column}hide-right-column{/if} {if $content_only} content_only {/if}"> {if !$content_only} voila mon code quand je rajoute : {if $isset($cms)}cms_{$cms.id}{/if} mes pages CMS deviennent blanches... Link to comment Share on other sites More sharing options...
Szed Posted February 17, 2014 Share Posted February 17, 2014 Oui, car comme j'ai dis, je ne suis pas sur pour le $cms.id Et c'est surtout du au $ devant isset qui n'a rien à faire la. Mea culpa Link to comment Share on other sites More sharing options...
VL10 Posted February 17, 2014 Author Share Posted February 17, 2014 (edited) Yes que je mette $cms.id ou $cms->id j'ai une page blanche... je cherche un peu et reviens vers vous, merci encore de vos réponses Edited February 17, 2014 by VL10 (see edit history) Link to comment Share on other sites More sharing options...
Szed Posted February 17, 2014 Share Posted February 17, 2014 Vous avez enlever le $ devant isset ? Car je viens de tester avec : {if isset($cms)}cms_{$cms->id}{/if} et ca fonctionne. Link to comment Share on other sites More sharing options...
VL10 Posted February 17, 2014 Author Share Posted February 17, 2014 Oui j'ai enlever le $ devant isset voici mon code ds global.css body.cms_7{ margin:0; padding:0; background: url(img/mag.jpg) no-repeat center fixed; -webkit-background-size: cover; /* pour Chrome et Safari */ -moz-background-size: cover; /* pour Firefox */ -o-background-size: cover; /* pour Opera */ { j'obtient quand je regarde dans mon navigateur une image avec un ? au milieu de ma page. image defini automatiquement en 125x125 Link to comment Share on other sites More sharing options...
Szed Posted February 17, 2014 Share Posted February 17, 2014 C'est votre chemin vers l'image qui n'est pas bon du coup. Si votre css est dans un dossier css de votre thème, et l'image dans un dossier img, alors l'url est ../img/votreimage.jpg Link to comment Share on other sites More sharing options...
VL10 Posted February 17, 2014 Author Share Posted February 17, 2014 Merci beaucoup !!! Link to comment Share on other sites More sharing options...
toujoursDbugs Posted April 21, 2014 Share Posted April 21, 2014 Salut, très intèressant c'est pile poil ce que je cherchait mais à appliquer dans une div. 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