franciccio-ITALIANO Posted November 4, 2019 Share Posted November 4, 2019 Hi, I've created 5 substantially the same template files. They change for only one feature: 1 class of the same css file. With processwire I can associate to each page of the site a different template file, after uploading it online, okay, but I was wondering if the software exists a way already provided to choose the class/css-file of a template project. I hope I've explained myself. Did I make myself understood? Translated with www.DeepL.com/Translator Link to comment Share on other sites More sharing options...
3fingers Posted November 4, 2019 Share Posted November 4, 2019 Ciao Franciccio, where this class lives into your template file? On the body tag? Are you using it to style the whole page differently according to its content? In this case you could add those classes programmatically according to the page you're serving, using just one template file. (btw I'm italian too, write me a pm if you're in trouble and I will send you my skype username there, but first let's try to solve this inside the forum). 3 Link to comment Share on other sites More sharing options...
franciccio-ITALIANO Posted November 6, 2019 Author Share Posted November 6, 2019 Ciao 3fingers! Il file del template è lo stesso in tutte le parti, tranne che in una classe per un certo bottone, perchè il sito ha 2 temi di argomento, politica ed ecologia, quindi nei due casi vorrei cambiare solo il colore di questo bottone. Inoltre ho creato uno spazio pubblicità con sfondi diversi per variare in base al contenuto, appunto 5, quindi avrei 7 file del template tutti con una o 2 lievissime differenze. Questa classe css non è nel file-html, ma nel file style.css linkato nel file html. In teoria potrei mettere il css dentro il file html, ma si farebbe confusione estetica e funzionale, quindi mi chiedevo se processwire avesse una formula per afferrare quella classe dentro style.css, invece del nome semplice della semplice classe messa nel classico modo dentro l'html. Non so mi pare difficile, ma chiedere non nuoce, conoscendo l'onnipotenza di processwire... :D traducting... Hello 3fingers! The template file is the same in all parts, except in a class for a certain button, because the site has 2 themes of topic, politics and ecology, so in both cases I would like to change only the color of this button. This css class is not in the file-html, but in the style.css file linked in the html file. In theory I could put the css inside the html file, but it would make aesthetic and functional confusion, so I wondered if processwire had a formula to grab that class inside style.css, instead of the simple name of the simple class put in the classic way inside the html. I don't know it seems difficult, but asking doesn't hurt, knowing the omnipotence of processwire... Tradotto con www.DeepL.com/Translator Link to comment Share on other sites More sharing options...
3fingers Posted November 6, 2019 Share Posted November 6, 2019 Ciao franciccio, non è processwire che deve "pescare" la classe nel tuo css, ma sei tu che ( a seconda di una particolare condizione ) puoi dire al sistema di fare un echo di una classe piuttosto che di un'altra. Facciamo finta che tu abbia due categorie di pagine (politica ed ecologia) e al si sotto di esse le pagine corrispondenti, a questo punto puoi semplicemente definire la classe che vuoi sul bottone: // Insert a class conditionally <button class="<?= ($page->parent == 'politica') ? 'some-class' : 'other-class' ?>"></button> Lo stesso principio vale per gli sfondi. ---- It's not pw to pick the classes from the css, instead is you choosing the right class based upon some conditions (if/else, switch statements, etc.). Let's pretend you have to main parent categories (politica ed ecologia), at this point you can easy define which class you need to be applied on the button. 1 Link to comment Share on other sites More sharing options...
franciccio-ITALIANO Posted November 6, 2019 Author Share Posted November 6, 2019 ok ma come faccio ad assegnare ad una pagina una categoria? Quante categorie posso creare? Ma soprattutto... come le creo? Le mie classi simili nel file style.css si chiamano "note-pdp-adx1", "note-pdp-adx2", "note-pdp-adx3", "note-pdp-adx4" devo scriverla al posto di "some-class" o di "other-class"? <button class="<?= ($page->parent == 'politica') ? 'some-class' : 'other-class' ?>"></button> Inoltre, se nel file html avessi lo <a style="color: red;"> che vorrei cambiare in <a style="color: red;">, e non volessi caricare un nuovo file del template con solo questa minima differenza, che codice dovrei utilizzare in teoria? ................................... traducting... ................................... Okay, but how do I assign a page to a category? How many categories can I create? But above all... how do I create them? My similar classes in the style.css file are called "note-pdp-adx1", "note-pdp-adx2", "note-pdp-adx3", "note-pdp-adx4". should I write it instead of some-class or other-class? <button class="<?= ($page->parent == 'politica') ? 'some-class' : 'other-class' ?>"></button> Also, if in the html file I had the <a style="color: red;"> that I would like to change to <a style="color: red;">, and I didn't want to upload a new template file with only this slight difference, what code should I use in theory? Translated with www.DeepL.com/Translator Link to comment Share on other sites More sharing options...
3fingers Posted November 6, 2019 Share Posted November 6, 2019 It looks like you still need to grasp some concepts and logic of html/css and php in general. Write me a pm, I think a chat between me and you would be ideal for you. I'm trying not to pollute the forum with a bi-lingual discussion between us. 3 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