<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Mooti Blog - Développement Web</title>
	<atom:link href="http://blog.mootiweb.fr/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://blog.mootiweb.fr</link>
	<description>Développement web</description>
	<lastBuildDate>Thu, 07 Apr 2011 09:23:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>Les erreurs 404 qui en jettent un max !</title>
		<link>http://blog.mootiweb.fr/?p=140</link>
		<comments>http://blog.mootiweb.fr/?p=140#comments</comments>
		<pubDate>Tue, 25 May 2010 08:49:08 +0000</pubDate>
		<dc:creator>Mooti</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Webdesign]]></category>
		<category><![CDATA[erreur 404]]></category>
		<category><![CDATA[exemples]]></category>

		<guid isPermaLink="false">http://blog.mootiweb.fr/?p=140</guid>
		<description><![CDATA[Une erreur 404? Mais keskeussééééé? Quand vous tentez d&#8217;afficher une page d&#8217;un site Internet qui n&#8217;existe plus (ou pas) sur le serveur, le serveur HTTP va vous renvoyer un code d&#8217;erreur 404. Votre navigateur va alors comprendre que la page n&#8217;est pas disponible et va vous afficher un message du style : 404 File Not [...]]]></description>
			<content:encoded><![CDATA[<p>Une erreur 404? Mais keskeussééééé?</p>
<p style="text-align: center;"><img class="aligncenter size-full wp-image-161" title="404" src="http://blog.mootiweb.fr/wp-content/uploads/2010/05/404.jpg" alt="" width="477" height="197" /></p>
<p>Quand vous tentez d&#8217;afficher une page d&#8217;un site Internet qui n&#8217;existe plus (ou pas) sur le serveur, le serveur HTTP va vous renvoyer un code d&#8217;erreur 404.<br />
Votre navigateur va alors comprendre que la page n&#8217;est pas disponible et va vous afficher un message du style : <em>404 File Not Found. </em>Voyons voir comment personnaliser tout ça&#8230;</p>
<p><em><span id="more-140"></span></em></p>
<p>La où ça devient sympa, c&#8217;est qu&#8217;il est possible de personnaliser cette page d&#8217;erreur pour la rendre un peu plus attrayante. (moins eut été compliqué&#8230;)</p>
<p>Pour se faire, il vous faudra créer une page <em>404.html</em>, choisissez le nom que vous voulez d&#8217;ailleurs, ça n&#8217;a pas d&#8217;importance, puis spécifier au serveur qu&#8217;une erreur 404 doit vous rediriger vers cette page.</p>
<p>Créez un fichier <em>.htaccess </em>à la racine de votre site et indiquez le petit bout de code suivant :</p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;"><span style="color: #00007f;">ErrorDocument</span> <span style="color: #ff0000;">404</span> http://www.votre_site_super_cool.fr/404.php</pre></div></div>

<p>Je vous laisse libre de remplir votre page 404.html (ou bobMarley.php hein!) comme bon vous semble.</p>
<p>Essayez maintenant d&#8217;aller sur une page qui n&#8217;existe pas sur votre serveur. Si vous avez bien fait votre travail, vous devriez retomber sur votre page 404 personnalisée !<br />
Voici quelques exemples de pages 404 customisées par des gens plein d&#8217;imagination :</p>
<h2><a title="gog.com" href="http://www.gog.com/en/error/404" target="_blank">Gog.com</a></h2>
<p><a title="gog.com" href="http://www.gog.com/en/error/404" target="_blank"><img class="aligncenter size-full wp-image-145" title="gog-404-error-pages" src="http://blog.mootiweb.fr/wp-content/uploads/2010/05/gog-404-error-pages.jpg" alt="Page 404 de gog.com" width="570" height="325" /></a></p>
<h2><a title="css-tricks.com" href="http://css-tricks.com/0404" target="_blank">Css-tricks.com</a></h2>
<p><a title="Page 404 de css-tricks.com" href="http://css-tricks.com/0404" target="_blank"><img class="aligncenter size-full wp-image-146" title="csstricks-404-error-pages" src="http://blog.mootiweb.fr/wp-content/uploads/2010/05/csstricks-404-error-pages.jpg" alt="Page 404 de csstricks" width="570" height="545" /></a></p>
<h2><a title="blizzard.com" href="http://us.blizzard.com/en-us/error.html" target="_blank">Blizzard.com</a></h2>
<p><a title="Page 404 de Blizzard.com" href="http://us.blizzard.com/en-us/error.html" target="_blank"><img class="aligncenter size-full wp-image-147" title="Blizzard-Entertainment-404-error-pages" src="http://blog.mootiweb.fr/wp-content/uploads/2010/05/Blizzard-Entertainment-404-error-pages.jpg" alt="Page 404 de blizzard.com" width="570" height="434" /></a></p>
<p>Si ces 3 exemples n&#8217;ont pas suffit à éveiller votre imagination, vous pouvez en trouver d&#8217;autres <a title="Exemples de pages 404" href="http://www.1stwebdesigner.com/inspiration/unique-404-error-pages-inspiration/" target="_blank">ici</a> !</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mootiweb.fr/?feed=rss2&#038;p=140</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Les bonnes manières du développeur web</title>
		<link>http://blog.mootiweb.fr/?p=102</link>
		<comments>http://blog.mootiweb.fr/?p=102#comments</comments>
		<pubDate>Tue, 16 Mar 2010 09:51:51 +0000</pubDate>
		<dc:creator>Mooti</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[développement web]]></category>

		<guid isPermaLink="false">http://blog.mootiweb.fr/?p=102</guid>
		<description><![CDATA[A première vue, le développement de pages web a l'air plutôt simple. Il suffit de coller un peu de html, de css et de javascript ensembles, de bien mélanger, et vous avez votre page web.

Cependant, tout bon développeur web se doit de produire un code clair, sémantique et compatible avec les différents navigateurs Internet.]]></description>
			<content:encoded><![CDATA[<p><img class="aligncenter" title="css html" src="http://www.geeek.org/public/geekeries/css_html_love.jpg" alt="You are the css to my html" width="500" height="375" /></p>
<p>A première vue, le développement de pages web a l&#8217;air plutôt simple. Il suffit de coller un peu de html, de css et de javascript ensembles, de bien mélanger, et vous avez votre page web.</p>
<p>Cependant, tout bon développeur web se doit de produire un code clair, sémantique et compatible avec les différents navigateurs Internet.</p>
<p>Pour cela, il y a quelques règles simples à respecter.<span id="more-102"></span></p>
<h2><span style="color: #91d638;">Indiquez quelle div vous fermez</span></h2>
<p>La plupart du temps, les pages se terminent par une succession interminable de balises <em>&lt;/div&gt;</em>. Il est alors compliqué de savoir où on se trouve.</p>
<p>Indenter son code est une première bonne pratique et permet déjà de savoir si on a fermé assez de balises. <img src='http://blog.mootiweb.fr/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Cependant, le mieux reste encore d&#8217;indiquer via un petit commentaire, quelle div on vient de fermer comme dans l&#8217;exemple ci-dessous</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;header&quot;</span>&gt;</span>
 <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menu&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;gauche&quot;</span>&gt;</span>
 ...
 <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span><span style="color: #808080; font-style: italic;">&lt;!-- #menu.gauche --&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span><span style="color: #808080; font-style: italic;">&lt;!-- #header --&gt;</span></pre></td></tr></table></div>

<h2><span style="color: #91d638;">La technique du Reset CSS</span></h2>
<p>Les valeurs par défaut concernant les marges et le padding ne sont pas toujours les mêmes en fonction du navigateur utilisé. Pour éviter d&#8217;avoir une mise en page différente, on peut utiliser la technique du Reset CSS qui consiste à remettre à 0 certaines valeurs des éléments de notre page web.</p>
<p>Pour en savoir plus concernant le Reset CSS et son application, vous pouvez vous rendre sur l&#8217;<a title="Technique du Reset CSS" href="http://www.alsacreations.com/astuce/lire/36-reset-css.html" target="_blank">article d&#8217;Alsacreations</a>.</p>
<h2><span style="color: #91d638;">Ne pas utiliser @import</span></h2>
<p>Les fichiers CSS peuvent être inclus via la syntaxe <em>@import</em>. Cela peut être utilisé pour inclure un CSS dans un autre fichier CSS ou directement dans une page HTML.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">style</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/css&quot;</span>&gt;</span>
 @import url('style1.css');
 @import url('style2.css');
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">style</span>&gt;</span></pre></td></tr></table></div>

<p>Ce code fonctionne mais il est plus lent que le code ci-dessous pour inclure une feuille de style dans un document HTML.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">link</span> <span style="color: #000066;">rel</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">'stylesheet'</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">'text/css'</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">'style1.css'</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">link</span> <span style="color: #000066;">rel</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">'stylesheet'</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">'text/css'</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">'style2.css'</span>&gt;</span></pre></td></tr></table></div>

<p>Vous ne verrez pas de différence notoire entre les deux syntaxes sur des sites générant peu de trafic, mais vous saurez quoi faire quand vous aurez un site avec un million de visiteurs par jour (<span style="text-decoration: line-through;">comme mootiweb</span>). <img src='http://blog.mootiweb.fr/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h2><span style="color: #91d638;">Il faut <em>smusher</em> vos images!</span></h2>
<p>Heu quoi?</p>
<p>Par <em>smusher</em>, je veux dire optimiser vos images, c&#8217;est à dire avoir le meilleur rapport qualité/poids. Le terme <em>smusher</em> vient de l&#8217;outil que j&#8217;utilise qui s&#8217;appelle <a title="Smush It" href="http://developer.yahoo.com/yslow/smushit" target="_blank">Smush It</a>.</p>
<p><em>Smush it</em> est un outil online développé par Yahoo qui va donc vous permettre d&#8217;optimiser le poids de vos images sans perdre en qualité visuelle. L&#8217;outil promet des gains allant jusqu&#8217;à 70% du poids initial, ce qui n&#8217;est pas négligeable.</p>
<h2><span style="color: #91d638;">Ne mélangez pas CSS et HTML</span></h2>
<p>HTML est un langage de balisage permettant de structurer sémantiquement et mettre en forme le contenu des pages.</p>
<p>Il est parfois tentant d&#8217;insérer le style d&#8217;un élément directement dans la page html (parce que ça va tellement plus vite).</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://super_lien.com&quot;</span> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;background:#064; padding:3px; font-weight:bold&quot;</span>&gt;</span>Super lien!<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span></pre></td></tr></table></div>

<p>Ce code va à l&#8217;encontre de la philosophie même de CSS et dans un soucis de clarté de votre code, il est toujours préférable de mettre tout ce qui concerne le style de votre page dans un fichier CSS externe.</p>
<h2><span style="color: #91d638;">Le mix Javascript / HTML, c&#8217;est pas mieux!</span></h2>
<p>Il en est de même pour l&#8217;intégration du code Javascript. Le code suivant illustre la mauvaise habitude d&#8217;utiliser l&#8217;événement <em>onclick </em>directement sur un élément de la page HTML.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;mootiweb&quot;</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://www.mootiweb.fr&quot;</span> <span style="color: #000066;">onclick</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;alert('Superbe site!');&quot;</span>&gt;</span>Mooti Web<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span></pre></td></tr></table></div>

<p>On peut obtenir le même résultat en utilisant par exemple le framework JQuery.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
 $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#mootiweb'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">click</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
 <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Superbe site!'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Cela peut sembler un peu compliqué à utiliser mais si vous en prenez l&#8217;habitude, votre code sera toujours plus lisible et plus simple à maintenir, pour vous, ou pour quelqu&#8217;un souhaitant travailler sur vos sources.</p>
<h2><span style="color: #91d638;">Utilisez des commentaires conditionnels</span></h2>
<p>Malgré la récente mort annoncée d&#8217;Internet Explorer 6, certains clients demandent toujours des pages compatibles avec leur navigateur favori made by Microsoft.</p>
<p>En partant du constat que c&#8217;est un sacré bordel de développer des pages pour ce navigateur qui a du mal à respecter certains <a title="Standards W3C" href="http://www.w3.org/standards/">standards</a>, le mieux est encore d&#8217;élaborer deux feuilles de style bien distinctes et d&#8217;importer la bonne en fonction du navigateur utilisé par le visiteur.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!--[if !IE]&gt;</span>
<span style="color: #808080; font-style: italic;"> &lt;link href=&quot;style.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot; /&gt;</span>
<span style="color: #808080; font-style: italic;">&lt;![endif]--&gt;</span>
<span style="color: #808080; font-style: italic;">&lt;!--[if lte IE 6]&gt;</span>
<span style="color: #808080; font-style: italic;"> &lt;link href=&quot;styleIE.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot; /&gt;</span>
<span style="color: #808080; font-style: italic;"> &lt;![endif]--&gt;</span></pre></td></tr></table></div>

<p>Le code ci-dessus va donc importer une feuille de style spécifique au navigateur du méchant client sur son vieux navigateur IE6 (ou inférieur) et une feuille de style classique pour les autres navigateurs.</p>
<p>Il est possible de répéter le même code pour avoir une feuille de style spécifique aux navigateurs IE ayant une version supérieur à la 6.</p>
<h2><span style="color: #91d638;">Importez vos fichiers Javascript en bas de page</span></h2>
<p>Le problème de l&#8217;importation du Javascript entre les balises <em>&lt;head&gt;</em> et <em>&lt;/head&gt;</em> est qu&#8217;il va être chargé avant le contenu de votre page. Donc si le code concerne des éléments de la page, il risque de mal s&#8217;exécuter.</p>
<p>La solution est donc d&#8217;importer votre code Javascript juste avant la fin de la page.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;">  ...
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;jquery.js&quot;</span>&gt;</span>
 <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">body</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">html</span>&gt;</span></pre></td></tr></table></div>

<h2><span style="color: #91d638;">Testez votre code au fur et à mesure</span></h2>
<p>Voila une habitude qui peut vous faire gagner beaucoup de temps. On a tous développé un site en le testant exclusivement sur Firefox, et une fois arrivé à la fin du projet, on serre les fesses en ouvrant IE et en chargeant notre page.</p>
<p>Le temps de corriger tous les problèmes de mise en page et surtout de retrouver d&#8217;où viennent les différents décalages peut prendre énormément de temps.</p>
<p>La solution apparaît alors comme assez évidente, il suffit de tester régulièrement votre page sous les principaux navigateurs afin de savoir immédiatement où corriger un éventuel problème.</p>
<p>Ces bonnes manières ne sont pas toujours faciles à appliquer et ce serait mentir que de dire que je les ai toujours appliquées, mais plus un projet est important, plus ces règles facilitent la vie des développeurs web.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mootiweb.fr/?feed=rss2&#038;p=102</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Editeur WYSIWYG Javascript &#8211; TinyEditor.</title>
		<link>http://blog.mootiweb.fr/?p=8</link>
		<comments>http://blog.mootiweb.fr/?p=8#comments</comments>
		<pubDate>Tue, 16 Mar 2010 07:18:21 +0000</pubDate>
		<dc:creator>Mooti</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[éditeur javascript]]></category>
		<category><![CDATA[tinyeditor]]></category>

		<guid isPermaLink="false">http://blog.mootiweb.fr/?p=8</guid>
		<description><![CDATA[TinyEditor est un éditeur de texte simple et surtout très léger (8ko). Il est facilement customisable via CSS et reprend les principales fonctions d'un éditeur (gras, italique, souligné etc...)]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">Pour commencer ce blog axé &#8216;développement web&#8217; nous allons voir ensemble comment mettre en place un éditeur WYSIWYG (What You See Is What You Get) sur votre site.</p>
<p style="text-align: justify;">Pour se faire, nous allons utiliser <strong>TinyEditor</strong> qui est un éditeur de texte simple et surtout très léger (8ko). Il est facilement customisable via CSS et reprend les principales fonctions d&#8217;un éditeur (gras, italique, souligné etc&#8230;)</p>
<p style="text-align: justify;"><a href="http://sandbox.leigeber.com/tinyeditor/" target="_blank"><img class="size-full wp-image-25  aligncenter" title="TinyEditor" src="http://blog.mootiweb.fr/wp-content/uploads/2010/03/Image-1.png" alt="Aperçu de l'éditeur WYSIWYG TinyEditor" width="475" height="229" /></a></p>
<p style="text-align: justify;"><span id="more-8"></span><br />
Passons aux choses sérieuses maintenant jeune Padawan!</p>
<p style="text-align: justify;">Tout d&#8217;abord, commençons par télécharger l&#8217;<a title="Télécharger TinyEditor" href="http://forum.leigeber.com/index.php?app=downloads&amp;module=display&amp;section=download&amp;do=confirm_download&amp;id=10">archive</a> contenant TinyEditor sur le site du développeur du module (Michael Leigeber).</p>
<p style="text-align: justify;">On se retrouve avec un dossier contenant le code Javascript, la feuille de style CSS, les images de l&#8217;éditeur et une page de démonstration index.html .</p>
<p style="text-align: justify;">Voici la démarche à suivre pour mettre en place cet éditeur sur une page web. Vous allez voir, c&#8217;est easy win! <span style="text-decoration: line-through;">D&#8217;ailleurs, il suffit de reprendre le code de la page de démo pour éviter de lire la fin de cet article&#8230;</span></p>
<p style="text-align: justify;">Premièrement, il faut importer le fichier Javascript et la feuille de style CSS. Pour cela, il faut insérer les lignes suivantes entre les balises &lt;head&gt; et &lt;/head&gt; de votre page HTML.</p>
<p style="text-align: justify;">

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;tinyeditor.js&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span></pre></td></tr></table></div>

<p style="text-align: justify;">Il ne reste alors plus qu&#8217;à insérer l&#8217;éditeur sur votre page. Il suffit de placer votre textarea à l&#8217;endroit souhaité et de lui associer le code Javascript qui va bien.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">&lt;textarea id=&quot;input&quot; style=&quot;width:400px; height:200px&quot;&gt;&lt;/textarea&gt;
<span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #003366; font-weight: bold;">new</span> TINY.<span style="color: #660066;">editor</span>.<span style="color: #660066;">edit</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'editor'</span><span style="color: #339933;">,</span><span style="color: #009900;">&#123;</span>
 id<span style="color: #339933;">:</span><span style="color: #3366CC;">'input'</span><span style="color: #339933;">,</span>
 width<span style="color: #339933;">:</span><span style="color: #CC0000;">584</span><span style="color: #339933;">,</span>
 height<span style="color: #339933;">:</span><span style="color: #CC0000;">175</span><span style="color: #339933;">,</span>
 cssclass<span style="color: #339933;">:</span><span style="color: #3366CC;">'te'</span><span style="color: #339933;">,</span>
 controlclass<span style="color: #339933;">:</span><span style="color: #3366CC;">'tecontrol'</span><span style="color: #339933;">,</span>
 rowclass<span style="color: #339933;">:</span><span style="color: #3366CC;">'teheader'</span><span style="color: #339933;">,</span>
 dividerclass<span style="color: #339933;">:</span><span style="color: #3366CC;">'tedivider'</span><span style="color: #339933;">,</span>
 controls<span style="color: #339933;">:</span><span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'bold'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'italic'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'underline'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'strikethrough'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'|'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'subscript'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'superscript'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'|'</span><span style="color: #339933;">,</span>
 <span style="color: #3366CC;">'orderedlist'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'unorderedlist'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'|'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'outdent'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'indent'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'|'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'leftalign'</span><span style="color: #339933;">,</span>
 <span style="color: #3366CC;">'centeralign'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'rightalign'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'blockjustify'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'|'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'unformat'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'|'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'undo'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'redo'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'n'</span><span style="color: #339933;">,</span>
 <span style="color: #3366CC;">'font'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'size'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'style'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'|'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'image'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'hr'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'link'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'unlink'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'|'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'cut'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'copy'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'paste'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'print'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
 footer<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span>
 fonts<span style="color: #339933;">:</span><span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'Verdana'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'Arial'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'Georgia'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'Trebuchet MS'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
 xhtml<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span>
 cssfile<span style="color: #339933;">:</span><span style="color: #3366CC;">'style.css'</span><span style="color: #339933;">,</span>
 bodyid<span style="color: #339933;">:</span><span style="color: #3366CC;">'editor'</span><span style="color: #339933;">,</span>
 footerclass<span style="color: #339933;">:</span><span style="color: #3366CC;">'tefooter'</span><span style="color: #339933;">,</span>
 toggle<span style="color: #339933;">:</span><span style="color: #009900;">&#123;</span>text<span style="color: #339933;">:</span><span style="color: #3366CC;">'source'</span><span style="color: #339933;">,</span>activetext<span style="color: #339933;">:</span><span style="color: #3366CC;">'wysiwyg'</span><span style="color: #339933;">,</span>cssclass<span style="color: #339933;">:</span><span style="color: #3366CC;">'toggle'</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
 resize<span style="color: #339933;">:</span><span style="color: #009900;">&#123;</span>cssclass<span style="color: #339933;">:</span><span style="color: #3366CC;">'resize'</span><span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p style="text-align: justify;">Ici, deux paramètres nous intéressent particulièrement. <em>id </em>qui doit être le même que l&#8217;id du textarea auquel on souhaite appliquer l&#8217;éditeur et <em>controls</em> qui reprend la liste des contrôles à afficher. (vous savez, les boutons gras, italique et tout ça&#8230;)</p>
<p style="text-align: justify;">Je me devais également de vous dire avant de vous laisser gambader sur le net avec votre éditeur tout beau tout neuf que le premier paramètre dans <em>TINY.editor.edit</em> est le nom de l&#8217;instance de l&#8217;éditeur.</p>
<p style="text-align: justify;">TinyEditor étant une surcouche du textarea, ce nom va nous servir à valider les derniers changements de l&#8217;éditeur afin qu&#8217;ils soient pris en compte lorsque l&#8217;on voudra récupérer la valeur du textarea par exemple. Il suffira alors d&#8217;appeler la fonction <em>post() </em>sur le nom de l&#8217;instance de l&#8217;objet.</p>
<p style="text-align: justify;">Et voilà, c&#8217;est terminé!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mootiweb.fr/?feed=rss2&#038;p=8</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
