<?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>Le blog de Nakuni &#187; Dévellopement web</title>
	<atom:link href="http://blog.nakuni.com/category/devellopement-web/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.nakuni.com</link>
	<description>Ce qui m&#039;émotionne et/ou ce qui me fait réfléchir</description>
	<lastBuildDate>Thu, 19 Jan 2012 15:49:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Supprimer la valeur par default d&#8217;un input text avec Mootools</title>
		<link>http://blog.nakuni.com/2010/04/supprimer-la-valeur-par-default-dun-input-text-avec-mootools/</link>
		<comments>http://blog.nakuni.com/2010/04/supprimer-la-valeur-par-default-dun-input-text-avec-mootools/#comments</comments>
		<pubDate>Thu, 15 Apr 2010 09:37:06 +0000</pubDate>
		<dc:creator>Nakuni</dc:creator>
				<category><![CDATA[Dévellopement web]]></category>
		<category><![CDATA[mootools]]></category>

		<guid isPermaLink="false">http://blog.nakuni.com/?p=140</guid>
		<description><![CDATA[Vous avez un input text avec une value par defaut (Par exemple &#171;&#160;rechercher&#160;&#187; ou &#171;&#160;login&#160;&#187;) que vous souhaitez supprimer au clique et réafficher si il est vide une fois sorti du champ? Je viens d&#8217;écrire un petit bout de code pour faire ça avec Mootools: window.addEvent&#40;'domready', function&#40;&#41; &#123; var InputASup = $&#40;'conteneurpere'&#41;.getElements&#40;'.ChampAutoSup'&#41;; InputASup.each&#40;function&#40;UnInput&#41;&#123; var TextInput [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>Vous avez un input text avec une value par defaut (Par exemple &laquo;&nbsp;rechercher&nbsp;&raquo; ou &laquo;&nbsp;login&nbsp;&raquo;) que vous souhaitez supprimer au clique et réafficher si il est vide une fois sorti du champ?</p>
<p>Je viens d&#8217;écrire un petit bout de code pour faire ça avec Mootools:<br />
<span id="more-140"></span></p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">window.<span style="color: #660066;">addEvent</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'domready'</span><span style="color: #339933;">,</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: #003366; font-weight: bold;">var</span> InputASup <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'conteneurpere'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">getElements</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.ChampAutoSup'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   InputASup.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>UnInput<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
      <span style="color: #003366; font-weight: bold;">var</span> TextInput <span style="color: #339933;">=</span> UnInput.<span style="color: #660066;">get</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'value'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
      UnInput.<span style="color: #660066;">addEvent</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'focus'</span><span style="color: #339933;">,</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; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>UnInput.<span style="color: #660066;">get</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'value'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> TextInput<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>	
               UnInput.<span style="color: #660066;">set</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'value'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
           <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
       <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>
       UnInput.<span style="color: #660066;">addEvent</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'blur'</span><span style="color: #339933;">,</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; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>UnInput.<span style="color: #660066;">get</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'value'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>		
               UnInput.<span style="color: #660066;">set</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'value'</span><span style="color: #339933;">,</span> TextInput<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
           <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
       <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</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></div></div>

<p>Il vous suffit ensuite de rajouter la classe .ChampAutoSup aux Input concernés et de remplacer &laquo;&nbsp;ChampAutoSup&nbsp;&raquo; par l&#8217;ID du conteneur père. </p>
<p>Je ne suis pas un spécialiste de Javascript et si vous voyez une manière d&#8217;optimiser ce petit bout de code je suis bien entendu preneur <img src='http://blog.nakuni.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> . (d&#8217;ailleurs je me demande si créer des fonctons en dehors du domready est moins gourmand?)</p>
<div class="shr-publisher-140"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://blog.nakuni.com/2010/04/supprimer-la-valeur-par-default-dun-input-text-avec-mootools/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Limiter la taille d&#8217;un texte sans couper le dernier mot (en php)</title>
		<link>http://blog.nakuni.com/2010/03/limiter-la-taille-dun-texte-sans-couper-le-dernier-mot/</link>
		<comments>http://blog.nakuni.com/2010/03/limiter-la-taille-dun-texte-sans-couper-le-dernier-mot/#comments</comments>
		<pubDate>Tue, 30 Mar 2010 15:04:19 +0000</pubDate>
		<dc:creator>Nakuni</dc:creator>
				<category><![CDATA[Dévellopement web]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.nakuni.com/?p=131</guid>
		<description><![CDATA[Je viens de passer un moment à chercher une expression régulière me permettant de limiter la taille d&#8217;un texte sans couper la chaîne en plein milieu d&#8217;un mot. Finalement je dois vraiment être trop noob en expressions régulières car je n&#8217;ai pas trouvé, mais j&#8217;ai trouvé une alternative. function racourcirtexte&#40;$texte, $taille&#41;&#123; //on coupe à l'arrache [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>Je viens de passer un moment à chercher une expression régulière me permettant de limiter la taille d&#8217;un texte sans couper la chaîne en plein milieu d&#8217;un mot.<br />
Finalement je dois vraiment être trop noob en expressions régulières car je n&#8217;ai pas trouvé, mais j&#8217;ai trouvé une alternative.<br />
<span id="more-131"></span></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> racourcirtexte<span style="color: #009900;">&#40;</span><span style="color: #000088;">$texte</span><span style="color: #339933;">,</span> <span style="color: #000088;">$taille</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #666666; font-style: italic;">//on coupe à l'arrache</span>
	<span style="color: #000088;">$texte</span><span style="color: #339933;">=</span><span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$texte</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #000088;">$taille</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>	
&nbsp;
        <span style="color: #666666; font-style: italic;">//on vire la dernière suite de caractère (le dernier mot qu'il soit coupé ou pas)</span>
	<span style="color: #000088;">$pattern</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'#[[:space:]][^ ]+$#iU'</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$texte</span> <span style="color: #339933;">=</span> <span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$pattern</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$texte</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">return</span> <span style="color: #000088;">$texte</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Si quelqu&#8217;un à mieux, je suis preneur <img src='http://blog.nakuni.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>EDIT: Quelqu&#8217;un à mieux! Merci <a href="http://www.chapeauhelicoptere.com/">Jo helico</a> (Hop un autre BL offert <img src='http://blog.nakuni.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> ):</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">        <span style="color: #000000; font-weight: bold;">function</span> racourcirtexte<span style="color: #009900;">&#40;</span><span style="color: #000088;">$sText</span><span style="color: #339933;">,</span> <span style="color: #000088;">$iLimit</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sText</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #000088;">$iLimit</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$sText</span> <span style="color: #339933;">=</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sText</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #000088;">$iLimit</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$sText</span> <span style="color: #339933;">=</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sText</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #990000;">strrpos</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sText</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">' '</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #b1b100;">return</span> <span style="color: #000088;">$sText</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<div class="shr-publisher-131"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://blog.nakuni.com/2010/03/limiter-la-taille-dun-texte-sans-couper-le-dernier-mot/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Centrer verticalement une image à taille variable avec CSS et PHP</title>
		<link>http://blog.nakuni.com/2009/05/centrer-une-image-a-taille-variable-verticalement-avec-css-et-php/</link>
		<comments>http://blog.nakuni.com/2009/05/centrer-une-image-a-taille-variable-verticalement-avec-css-et-php/#comments</comments>
		<pubDate>Thu, 14 May 2009 10:18:24 +0000</pubDate>
		<dc:creator>Nakuni</dc:creator>
				<category><![CDATA[Dévellopement web]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.nakuni.com/?p=48</guid>
		<description><![CDATA[Oui un peu de développement web sur le blog maintenant, une nouvelle thématique qui n&#8217;a rien à voir avec les autres, un blog sans thématique c&#8217;est tout ce qu&#8217;il ne faut pas faire normalement et moi ça me plaît bien Bref non développeurs passez votre chemin!  J&#8217;ai longtemps galérer pour centrer verticalement des images dont [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>Oui un peu de développement web sur le blog maintenant, une nouvelle thématique qui n&#8217;a rien à voir avec les autres, un blog sans thématique c&#8217;est tout ce qu&#8217;il ne faut pas faire normalement et moi ça me plaît bien <img src='http://blog.nakuni.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Bref non développeurs passez votre chemin!  J&#8217;ai longtemps galérer pour centrer verticalement des images dont on ne peut pas connaître à l&#8217;avance la taille (par exemple une galerie de photos qui peuvent être en format portrait ou paysage, ou avoir des ratios différents).<br />
<span id="more-48"></span><br />
J&#8217;utilisai un tableau pour chaque image avec une propriété vertical-align, mais d&#8217;un c&#8217;était vraiment caca comme code, et de deux cela me forçait à inclure une marge sur les cotés (je n&#8217;ai jamais réussi à la virer cette fucking marge).</p>
<p>Et hier, après m&#8217;être embrouillé avec mon associée à ce sujet &laquo;&nbsp;mais je te dis que ce n&#8217;est pas possible pauvre graphiste à la con&nbsp;&raquo;, &laquo;&nbsp;mais si ça l&#8217;est forcement espèce de développeur de merde&nbsp;&raquo; (bon j&#8217;en rajoute un peu) j&#8217;ai encore une fois eu tort en trouvant une solution toute bête:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&lt;div class=&quot;cadres_photo&quot;&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #990000;">list</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$width</span><span style="color: #339933;">,</span> <span style="color: #000088;">$height</span><span style="color: #339933;">,</span> <span style="color: #000088;">$type</span><span style="color: #339933;">,</span> <span style="color: #000088;">$attr</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">getimagesize</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;photos/moncul.jpg&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$marge</span> <span style="color: #339933;">=</span> <span style="color: #990000;">round</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">57</span> <span style="color: #339933;">-</span> <span style="color: #000088;">$height</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">/</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;img src=&quot;photos/moncul.jpg&quot; alt=&quot;Mummm&quot; style=&quot;margin-top:'</span><span style="color: #339933;">.</span><span style="color: #000088;">$marge</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'px;&quot; /&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;/div&gt;</pre></div></div>

<p>(57 étant le height de .cadres_photo)</p>
<p>Voilà, cela servira peut-être à un mec aussi à l&#8217;ouest que moi qui tomberait ici grâce au super référencement de ce blog sans thématique précise <img src='http://blog.nakuni.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<div class="shr-publisher-48"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://blog.nakuni.com/2009/05/centrer-une-image-a-taille-variable-verticalement-avec-css-et-php/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

