21/01/2011, 21:28:21
Le plus rapide :
Si tu ne l'as pas encore remis : Extensions » Editeur TinyMCE WYSIWYG onglet "encodage des entités" : tu choisis "raw" (sinon tous les espaces deviendront insécables).
Retour dans la page : clique sur le bouton html (2ème ligne à droite barre d'outils du wysiwyg).
Dans la nouvelle fenêtre, écris <pre> {literal}{/literal}</pre> ( literal pour empêcher cmsms d'évaluer le code).
Positionne le curseur entre les 2 literal et colle ton code.
Cela devra donner ceci :
ex :
Problème, tu perds les couleurs.
Donc solution plus longue en gardant identités html dans la config du wysiwyg :
Tu vas dans les paramètres de Tiny : onglet avancé;
Formatage dans "Bloc de texte" : h1,h2,h3,h4,h5,h6,blockquote,dt,dd,code,samp,pre
Validation
Retour dans la page : écris {literal}{/literal} (pour empêcher cmsms d'évaluer le code).
Sélectionne le tout et applique le format : Preformatté.
Positionne le curseur entre les 2 literal et colle ton code.
Cela devra donner ceci après avoir décoché le wysiwyg :
ex :
Si tu ne l'as pas encore remis : Extensions » Editeur TinyMCE WYSIWYG onglet "encodage des entités" : tu choisis "raw" (sinon tous les espaces deviendront insécables).
Retour dans la page : clique sur le bouton html (2ème ligne à droite barre d'outils du wysiwyg).
Dans la nouvelle fenêtre, écris <pre> {literal}{/literal}</pre> ( literal pour empêcher cmsms d'évaluer le code).
Positionne le curseur entre les 2 literal et colle ton code.
Cela devra donner ceci :
ex :
Code :
<pre>{literal}<span style="color: #cc6600;">my</span><span style="color: #000000;"> </span><span style="color: #00dddd;">$file</span><span style="color: #000000;"> </span><span style="color: #000000;">= </span><span style="color: #990000;">'c:/mesprogrammes/essai.pl'</span><span style="color: #000000;">;<br /></span><span style="color: #cc6600;">if</span><span style="color: #000000;"> </span><span style="color: #000000;">( </span><span style="color: #cc6600;">-d</span><span style="color: #000000;"> </span><span style="color: #990000;">'c:/mesprogrammes'</span><span style="color: #000000;"> </span><span style="color: #000000;">) {<br /> </span><span style="color: #cc6600;">if</span><span style="color: #000000;"> </span><span style="color: #000000;">(</span><span style="color: #cc6600;">-e</span><span style="color: #000000;"> </span><span style="color: #990000;">'c:/mesprogrammes/essai.pl'</span><span style="color: #000000;">) {<br /> </span><span style="color: #cc6600;">print</span><span style="color: #000000;"> </span><span style="color: #990000;">"Le fichier existe OK"</span><span style="color: #000000;">;<br /> ...<br /> }<br /> </span><span style="color: #cc6600;">else</span><span style="color: #000000;"> </span><span style="color: #000000;">{<br /> </span><span style="color: #cc6600;">print</span>{/literal}</pre>
Problème, tu perds les couleurs.
Donc solution plus longue en gardant identités html dans la config du wysiwyg :
Tu vas dans les paramètres de Tiny : onglet avancé;
Formatage dans "Bloc de texte" : h1,h2,h3,h4,h5,h6,blockquote,dt,dd,code,samp,pre
Validation
Retour dans la page : écris {literal}{/literal} (pour empêcher cmsms d'évaluer le code).
Sélectionne le tout et applique le format : Preformatté.
Positionne le curseur entre les 2 literal et colle ton code.
Cela devra donner ceci après avoir décoché le wysiwyg :
ex :
Code :
<pre>{literal}<span style="color: #cc6600;">my</span><span style="color: #000000;"> </span><span style="color: #00dddd;">$file</span><span style="color: #000000;"> </span><span style="color: #000000;">= </span><span style="color: #990000;">'c:/mesprogrammes/essai.pl'</span><span style="color: #000000;">;<br /></span><span style="color: #cc6600;">if</span><span style="color: #000000;"> </span><span style="color: #000000;">( </span><span style="color: #cc6600;">-d</span><span style="color: #000000;"> </span><span style="color: #990000;">'c:/mesprogrammes'</span><span style="color: #000000;"> </span><span style="color: #000000;">) {<br /> </span><span style="color: #cc6600;">if</span><span style="color: #000000;"> </span><span style="color: #000000;">(</span><span style="color: #cc6600;">-e</span><span style="color: #000000;"> </span><span style="color: #990000;">'c:/mesprogrammes/essai.pl'</span><span style="color: #000000;">) {<br /> </span><span style="color: #cc6600;">print</span><span style="color: #000000;"> </span><span style="color: #990000;">"Le fichier existe OK"</span><span style="color: #000000;">;<br /> ...<br /> }<br /> </span><span style="color: #cc6600;">else</span><span style="color: #000000;"> </span><span style="color: #000000;">{<br /> </span><span style="color: #cc6600;">print</span>{/literal}</pre>