<?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>Make me pulse - Making a better life for web developer since 2006 &#187; Tips</title>
	<atom:link href="http://blog.makemepulse.com/category/tips/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.makemepulse.com</link>
	<description>Making a better life for web developer since 2006</description>
	<lastBuildDate>Thu, 22 Apr 2010 15:56:23 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<atom:link rel='hub' href='http://blog.makemepulse.com/?pushpress=hub'/>
		<item>
		<title>What&#8217;s new on Make Me Pulse ?</title>
		<link>http://blog.makemepulse.com/2009/03/26/whats-new-on-make-me-pulse/</link>
		<comments>http://blog.makemepulse.com/2009/03/26/whats-new-on-make-me-pulse/#comments</comments>
		<pubDate>Thu, 26 Mar 2009 16:14:03 +0000</pubDate>
		<dc:creator>Antoine Ughetto</dc:creator>
				<category><![CDATA[3D]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Friends]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Make Me Pulse]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Our lab]]></category>
		<category><![CDATA[Php]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[YUI team]]></category>

		<guid isPermaLink="false">http://blog.makemepulse.com/?p=231</guid>
		<description><![CDATA[Hi !
After our (soon) first year of life, it&#8217;s time to show a part of our differents works. As you know, Make Me Pulse makes only development (Flash and PHP). Here we go for a few selection of our work
Our biggest project was to work on the revamp of NRJ website platforms. We work with [...]]]></description>
			<content:encoded><![CDATA[<p>Hi !<br />
After our (soon) first year of life, it&#8217;s time to show a part of our differents works. As you know, Make Me Pulse makes only development (Flash and PHP). Here we go for a few selection of our work</p>
<p>Our biggest project was to work on the revamp of NRJ website platforms. We work with e-NRJ development team to made this possible. It was a huge work during 6 months and the result can be check on <a href="http://www.cheriefm.fr/" target="_blank">http://www.cheriefm.fr/</a></p>
<p style="text-align: center;"><img class="size-full wp-image-232 aligncenter" title="nrj" src="http://blog.makemepulse.com/wp-content/uploads/2009/03/nrj.jpg" alt="nrj" width="500" height="351" /></p>
<p style="text-align: left;">We also worked with <a href="http://www.addictionagency.com/" target="_blank">Addiction Agency</a>, some &#8220;old&#8221; friends from Publicis on several projects for Eurosport. We worked with them on another project for <a href="http://www.rm-gattefosse.com/" target="_blank">RM Gatte Fossé</a>.</p>
<p style="text-align: center;"><img class="size-full wp-image-233 aligncenter" title="rmg" src="http://blog.makemepulse.com/wp-content/uploads/2009/03/rmg.jpg" alt="rmg" width="500" height="322" /></p>
<p style="text-align: left;">We have also work with Digitas on the new <a href="http://www.nissan.co.uk/" target="_blank">Nissan website</a>. (<a title="fwa" href="http://www.thefwa.com/" target="_blank">FWA</a> Site of the Day Baby <img src='http://blog.makemepulse.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> )</p>
<p style="text-align: center;"><img class="size-full wp-image-234 aligncenter" title="nissan" src="http://blog.makemepulse.com/wp-content/uploads/2009/03/nissan.jpg" alt="nissan" width="500" height="251" /></p>
<p style="text-align: left;">We just finished the first part off the new <a href="http://www.dior-watches.com/" target="_blank">Dior watches</a> website (full Javascript with YUI&#8230; ouch <img src='http://blog.makemepulse.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  ) with <a href="http://www.theblastmachine.com" target="_blank">The Blast Machine</a>.</p>
<p style="text-align: center;"><img class="size-full wp-image-235 aligncenter" title="dior" src="http://blog.makemepulse.com/wp-content/uploads/2009/03/dior.jpg" alt="dior" width="500" height="249" /></p>
<p style="text-align: left;">And to finish this selection, a few words about our best meeting of 2008, Yohan and Olivier from <a href="http://www.jamsbrain.com/" target="_blank">Jam&#8217;s Brain</a>. We work with them on <a href="http://www.modepass.com" target="_blank">Modepass.com</a> (yes we are geek and we also like beauty and fashion !) and a new version will soon be launched.</p>
<p style="text-align: center;"><img class="size-full wp-image-236 aligncenter" title="modepass" src="http://blog.makemepulse.com/wp-content/uploads/2009/03/modepass.jpg" alt="modepass" width="500" height="428" /></p>
<p style="text-align: left;">To close, a few words about the future of Make Me Pulse. We have a new Senior PHP/Mysql Developper which comes at the beginning of May. To complete our team<strong> we are also hiring a talented Junior PHP/Javascript developper</strong>&#8230; so if you&#8217;are interested and near Paris (it&#8217;s better) feel free to contact us at contact_AT_makemepulse.com .</p>
<p style="text-align: left;">Nico &amp; Antoine</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.makemepulse.com/2009/03/26/whats-new-on-make-me-pulse/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Using the Zend Framework URL rewriting</title>
		<link>http://blog.makemepulse.com/2009/01/15/using-the-zend-framework-url-rewriting/</link>
		<comments>http://blog.makemepulse.com/2009/01/15/using-the-zend-framework-url-rewriting/#comments</comments>
		<pubDate>Wed, 14 Jan 2009 23:05:11 +0000</pubDate>
		<dc:creator>Ludovic Hindryckx</dc:creator>
				<category><![CDATA[Php]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Regexp]]></category>
		<category><![CDATA[Router]]></category>
		<category><![CDATA[URL rewriting]]></category>
		<category><![CDATA[Zend controller router]]></category>
		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://blog.makemepulse.com/?p=197</guid>
		<description><![CDATA[Today for a good website&#8217;s referencement in Google, it&#8217;s necessary to have an URL rewriting.
For this implementation, without the Zend Framework classes, you need to have a htaccess file with all URL rewriting rules.
For instance :

RewriteEngine on
RewriteBase /path/website/base/application/
RewriteRule ^([a-zA-Z0-9-_]+)/([a-zA-Z0-9-_]+)\.html$ index.php?arg1=$1&#38;arg2=$2 [L]

If your application is based on ZF, we have a htaccess base file which will [...]]]></description>
			<content:encoded><![CDATA[<p>Today for a good website&#8217;s referencement in Google, it&#8217;s necessary to have an URL rewriting.</p>
<p>For this implementation, without the <a href="http://framework.zend.com/manual/en/" target="_blank">Zend Framework</a> classes, you need to have a htaccess file with all URL rewriting rules.</p>
<p>For instance :</p>

<div class="wp_syntax"><div class="code"><pre class="htaccess" style="font-family:monospace;">RewriteEngine on
RewriteBase /path/website/base/application/
RewriteRule ^([a-zA-Z0-9-_]+)/([a-zA-Z0-9-_]+)\.html$ index.php?arg1=$1&amp;arg2=$2 [L]</pre></div></div>

<p>If your application is based on ZF, we have a htaccess base file which will redirect all php files to the boostrap (<a href="http://framework.zend.com/docs/quickstart/create-a-bootstrap-file" target="_blank">what is the bootstrap ?</a>), and ZF classes will manage all redirection rules.</p>
<p>How to implement the URL rewriting with ZF classes ?</p>
<p>In order to have a better and clearer vision of all our rewriting rules, we are going to use a ini config file.</p>
<p>Here is an example with several rewriting rules :<br />
in a first time in our ini file, we have to define the default route for ZF application.<br />
ZF classes needs a model based rewriting.</p>

<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;"><span style="color: #000066; font-weight:bold;"><span style="">&#91;</span>url_rewriting<span style="">&#93;</span></span>
<span style="color: #666666; font-style: italic;">;default route</span>
routes.default.route <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #933;">&quot;:controller/:argument1/:argument2.html&quot;</span>
<span style="color: #666666; font-style: italic;">;argument which will be find as $_GET variable</span>
routes.default.reqs.argument1 <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #933;">&quot;([A-Za-z0-9-_]+)&quot;</span>
routes.default.reqs.argument2 <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #933;">&quot;([A-Za-z0-9-_]+)&quot;</span>
<span style="color: #666666; font-style: italic;">;default controller in ZF application</span>
routes.default.reqs.controller <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #933;">&quot;([A-Za-z0-9]+)&quot;</span>
<span style="color: #666666; font-style: italic;">;default action in ZF application</span>
routes.default.reqs.action <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #933;">&quot;([A-Za-z0-9]+)&quot;</span></pre></div></div>

<p>In this example, we can find the controller argument in addition of our variables. It&#8217;s not compulsory, but advised. If you don&#8217;t want this value in your URL, you&#8217;ll have to precise more rewrite rules.</p>
<p>Now we have our default route and we can add specific rules and routes. It&#8217;s possible for the developer to shape as same as a htaccess file.</p>
<p>One instance of rewriting rules :</p>

<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">;We have to specify the kind of rewriting route, here we are going to use the Regex type like in a htaccess file</span>
routes.route1.type <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #933;">&quot;Zend_Controller_Router_Route_Regex&quot;</span>
<span style="color: #666666; font-style: italic;">;Adding the route structure, with all Regexp pattern</span>
routes.route1.route <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #933;">&quot;([a-zA-Z0-9-_]+)/([a-zA-Z0-9-_]+)/([0-9-_]+)-([0-9-_]+)\.html&quot;</span>
<span style="color: #666666; font-style: italic;">;for the default controller, we also use a regexp, in order to get directly the URL value.</span>
<span style="color: #666666; font-style: italic;">;you can specify controller's value if the controller name is not in the URL route structure</span>
routes.route1.defaults.controller <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #933;">&quot;([a-zA-Z0-9-_]+)&quot;</span>
<span style="color: #666666; font-style: italic;">;here we specify the action because it's not present in my URL structure</span>
<span style="color: #666666; font-style: italic;">;Like the controller, you can add the action in the URL</span>
routes.route1.defaults.action <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #933;">&quot;myactionincontroller&quot;</span>
<span style="color: #666666; font-style: italic;">;Now we specify the mapping of our variable as we can see in a htaccess file : $1, $2 etc... </span>
routes.route1.map.1 <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #933;">&quot;controller&quot;</span>
routes.route1.map.2 <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #933;">&quot;argument1&quot;</span>
routes.route1.map.3 <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #933;">&quot;argument2&quot;</span></pre></div></div>

<p>Our ini config file is done, you just have to add all route needed for your ZF application.</p>
<p>Now we have to load the config file in the bootstrap :</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Getting the Zend Controller Instance</span>
<span style="color: #000088;">$router</span> <span style="color: #339933;">=</span> Zend_Controller_Front<span style="color: #339933;">::</span><span style="color: #004000;">getInstance</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getRouter</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// Creating a Zend_Config_Ini instance.</span>
<span style="color: #000088;">$config</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Zend_Config_Ini<span style="color: #009900;">&#40;</span><span style="color: #990000;">dirname</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">__FILE__</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;/path/to/config/file/rewriting.ini&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'url_rewriting'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// Adding my Zend Config to my Zend Controller instance</span>
<span style="color: #000088;">$router</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addConfig</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$config</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'routes'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>As you can see, it&#8217;s very simple to implement the config file to the ZF application.<br />
You can have many possibilities with the ZF Router, you&#8217;ll can find all information about classes <a href="http://framework.zend.com/manual/en/zend.controller.router.html" target="_blank">here</a>. I choose to use the ini file because it&#8217;s ligther than a XML file for PHP language.</p>
<p>Of course, you have to enable <a href="http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html" target="_blank">Apache&#8217;s rewrite module</a> and respect the ZF&#8217;s htaccess file.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.makemepulse.com/2009/01/15/using-the-zend-framework-url-rewriting/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PaperWorld3D framework</title>
		<link>http://blog.makemepulse.com/2008/04/29/paperworld3d-framework/</link>
		<comments>http://blog.makemepulse.com/2008/04/29/paperworld3d-framework/#comments</comments>
		<pubDate>Tue, 29 Apr 2008 11:11:22 +0000</pubDate>
		<dc:creator>Nicolas Rajabaly</dc:creator>
				<category><![CDATA[3D]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Papervision3D]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[red5]]></category>

		<guid isPermaLink="false">http://blog.makemepulse.com/2008/04/29/paperworld3d-framework/</guid>
		<description><![CDATA[The genious developer Trevor Burton, helped by Influxis, red5Sserver, and a founder of Papervision, John Grden, announced the release of PaperWorld3D.
PaperWorld3D is a 3D game engine for developing virtual worlds and MMOGs in Flash. Based on existing open-source projects like PaperVision3D and Red5, the engine is available under LGPL.
“If you can do it in Papervision, [...]]]></description>
			<content:encoded><![CDATA[<p>The genious developer Trevor Burton, helped by <a href="http://www.influxis.com/">Influxis</a>, <a href="http://www.red5server.com/">red5Sserver</a>, and a founder of Papervision, <a href="http://www.rockonflash.com/blog/">John Grden</a>, announced the release of PaperWorld3D.<br />
PaperWorld3D is a 3D game engine for developing virtual worlds and MMOGs in Flash. Based on existing open-source projects like PaperVision3D and Red5, the engine is available under LGPL.</p>
<p>“If you can do it in Papervision, you can do it multiplayer over the network with PaperWorld.&#8221;</p>
<p><a href="http://blog.makemepulse.com/2008/04/29/paperworld3d-framework/"><em>Click here to view the embedded video.</em></a></p>
<p><a href="http://blog.makemepulse.com/2008/04/29/paperworld3d-framework/"><em>Click here to view the embedded video.</em></a></p>
<p>The PaperWorld3D project is hosted at Google Code :   <a href="http://code.google.com/p/paperworld3d/">http://code.google.com/p/paperworld3d/</a></p>
<p>You can download the latest stable versions of the code, along with the accompanying documentation, and the latest builds of the demo game ‘Aereon’ build using PaperWorld3D from:  <a href="http://code.google.com/p/paperworld3d/downloads/list"> http://code.google.com/p/paperworld3d/downloads/list</a></p>
<p>Here a good installation tutorial : <a href="http://www.paultondeur.com/2008/04/21/paperworld3d-v01-installation-tutorial/">paperworld3d-v01-installation-tutorial</a></p>
<p><a href="http://paperworld3d.com/">Check It</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.makemepulse.com/2008/04/29/paperworld3d-framework/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SPL autoloading in PHP</title>
		<link>http://blog.makemepulse.com/2008/04/21/spl-autoloading-in-php/</link>
		<comments>http://blog.makemepulse.com/2008/04/21/spl-autoloading-in-php/#comments</comments>
		<pubDate>Mon, 21 Apr 2008 09:44:52 +0000</pubDate>
		<dc:creator>Antoine Ughetto</dc:creator>
				<category><![CDATA[Php]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://blog.makemepulse.com/2008/04/21/spl-autoloading-in-php/</guid>
		<description><![CDATA[In php5 we have a fabulous new feature, autoloading Objects. This function load dynamically classes.Before this magic function, we had to include all needed files before using an object.
How it works ? Very simple :

function __autoload&#40;$class&#41; &#123;
    if&#40;is_file&#40;$class . '.php'&#41;&#41;&#123;
          require_once $class.'.php';
    &#125;else&#123;
  [...]]]></description>
			<content:encoded><![CDATA[<p>In php5 we have a fabulous new feature, <a href="http://fr.php.net/manual/en/language.oop5.autoload.php" target="_blank">autoloading Objects</a>. This function load dynamically classes.Before this magic function, we had to include all needed files before using an object.<br />
How it works ? Very simple :</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> __autoload<span style="color: #009900;">&#40;</span><span style="color: #000088;">$class</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;">is_file</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$class</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'.php'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
          <span style="color: #b1b100;">require_once</span> <span style="color: #000088;">$class</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'.php'</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span>
          <span style="color: #990000;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Error when trying to load <span style="color: #009933; font-weight: bold;">%s</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$class</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000088;">$mmpObj</span>  <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> MmpClass<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>In php &gt;= 5.1.2 a new SPL function upgrade this function. How ? <span id="more-99"></span>You can declare multiple autoload functions. You can register as much autoload functions as you want with the <a href="http://fr.php.net/manual/en/function.spl-autoload-register.php" target="_blank">spl_autoload_register</a> function.<br />
A small example :<br />
<em>We have an application with source classes in /kernel. We have specific classes in a different directory : /apps/lib. The autoload functions are defined in a /config/config.ini.php file. In the /kernel we have differents subdirectory.</em></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">spl_autoload_register</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">,</span><span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> appsLibLoader<span style="color: #009900;">&#40;</span><span style="color: #000088;">$classLib</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #000088;">$classLib</span> <span style="color: #339933;">=</span> <span style="color: #990000;">strtolower</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$classLib</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
&nbsp;
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">is_file</span><span style="color: #009900;">&#40;</span>__DIR__<span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;/../apps/lib/lib.&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$classLib</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;.php&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
 	<span style="color: #b1b100;">require</span><span style="color: #009900;">&#40;</span>__DIR__<span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;/../apps/lib/lib.&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$classLib</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;.php&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span>
       <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;ERROR during Loading class::&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$classLib</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #000000; font-weight: bold;">function</span> kernelLoader<span style="color: #009900;">&#40;</span><span style="color: #000088;">$classKernel</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$iterator</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> RecursiveIteratorIterator<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> RecursiveDirectoryIterator<span style="color: #009900;">&#40;</span>__DIR__<span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;/../kernel/&quot;</span><span style="color: #339933;">,</span>RecursiveDirectoryIterator<span style="color: #339933;">::</span><span style="color: #004000;">KEY_AS_FILENAME</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>RecursiveIteratorIterator<span style="color: #339933;">::</span><span style="color: #004000;">SELF_FIRST</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$iterator</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$entry</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: #000088;">$entry</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>isFile<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;&amp;</span>amp<span style="color: #339933;">;</span> <span style="color: #990000;">strtolower</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$classKernel</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #990000;">strtolower</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">basename</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$iterator</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>current<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;.php&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        	<span style="color: #b1b100;">require</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$iterator</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>getPathname<span style="color: #009900;">&#40;</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: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #990000;">spl_autoload_register</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'appsLibLoader'</span><span style="color: #339933;">,</span><span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">spl_autoload_register</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'kernelLoader'</span><span style="color: #339933;">,</span><span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.makemepulse.com/2008/04/21/spl-autoloading-in-php/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Youtube Player Loader Class in AS2</title>
		<link>http://blog.makemepulse.com/2008/04/04/youtube-player-loader-class-in-as2/</link>
		<comments>http://blog.makemepulse.com/2008/04/04/youtube-player-loader-class-in-as2/#comments</comments>
		<pubDate>Fri, 04 Apr 2008 12:10:01 +0000</pubDate>
		<dc:creator>Nicolas Rajabaly</dc:creator>
				<category><![CDATA[AS2]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flash 8]]></category>
		<category><![CDATA[Pixlib]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://blog.makemepulse.com/2008/04/04/youtube-player-loader-class-in-as2/</guid>
		<description><![CDATA[Just a little class that I made this week to load the youtube flash player in a flash. This class is made in action script 2 with the help of the pixlib. 

import com.bourre.commands.Delegate;
import com.bourre.events.BasicEvent;
import com.bourre.events.EventType;
import com.bourre.events.NumberEvent;
import com.bourre.visual.MovieClipHelper;
import com.bourre.commands.CommandManagerMS;
import com.bourre.core.HashCodeFactory;
/**
* @author Rajabaly Nicolas
* @version 0.1
*/

class YoutubeLoader extends MovieClipHelper {

	private var _mc:MovieClip;
	private var _scale:Number;
	private var _commandMs:CommandManagerMS;
	private [...]]]></description>
			<content:encoded><![CDATA[<p>Just a little class that I made this week to load the youtube flash player in a flash. This class is made in action script 2 with the help of the <a href="http://osflash.org/projects/pixlib">pixlib</a>. </p>
<pre langage="Actionscript">
import com.bourre.commands.Delegate;
import com.bourre.events.BasicEvent;
import com.bourre.events.EventType;
import com.bourre.events.NumberEvent;
import com.bourre.visual.MovieClipHelper;
import com.bourre.commands.CommandManagerMS;
import com.bourre.core.HashCodeFactory;
/**
* @author Rajabaly Nicolas
* @version 0.1
*/

class YoutubeLoader extends MovieClipHelper {

	private var _mc:MovieClip;
	private var _scale:Number;
	private var _commandMs:CommandManagerMS;
	private var _delCheckPlayer:Delegate;
	private var _mcl:MovieClipLoader;
	private var _listener:Object;
	//
	static public var LOAD_START:EventType = new EventType("onLoadYoutubePlayerStart");
	static public var LOAD_PROGRESS:EventType = new EventType("onLoadYoutubePlayerProgress");
	static public var LOAD_COMPLETE:EventType = new EventType("onLoadYoutubePlayerComplete");
	static public var PLAYER_IS_READY:EventType = new EventType("onYoutubePlayerReady");
	static public var PLAYERLOADER_IS_OPEN:EventType = new EventType("onYoutubeLoaderOpen");
	static public var PLAYERLOADER_IS_CLOSE:EventType = new EventType("onYoutubeLoaderClose");

	public function YoutubeLoader(name:String, mc:MovieClip) {
		super(name, mc);
		_commandMs = CommandManagerMS.getInstance();
		_delCheckPlayer = new Delegate(this, _checkPlayer);
		System.security.allowDomain("http://youtube.com");
	}

	private function _checkPlayer():Void{
		if (_mc.isPlayerLoaded()) {
			_commandMs.remove(_delCheckPlayer);
			_mc._alpha=100;
			_mc._xscale = _mc._yscale = _scale;
			_oEB.dispatchEvent(new BasicEvent(PLAYER_IS_READY));
		}
	}

	private function _loadProgressPlayer(myTarget:MovieClip, myBytesLoaded:Number, myBytesTotal:Number):Void {
		var myPrcent:Number = Math.round(myBytesLoaded / myBytesTotal * 100);
		_oEB.dispatchEvent(new NumberEvent(LOAD_PROGRESS, myPrcent));
	}

	private function _loadCompletePlayer():Void {
		_oEB.dispatchEvent(new BasicEvent(LOAD_COMPLETE));
		_commandMs.delay(_delCheckPlayer, 250);
	}

	private function _loadStartPlayer():Void {
		_oEB.dispatchEvent(new BasicEvent(LOAD_START));
	}

	public function open(myId:String, myScale:Number):Void {
		_scale = myScale;
		_mc = view.createEmptyMovieClip(HashCodeFactory.getNextName(), 1);
		_mc._alpha=0;
		_mcl = new MovieClipLoader();
		_listener = new Object();
		_listener.onLoadStart = Delegate.create(this, _loadStartPlayer);
		_listener.onLoadProgress = Delegate.create(this, _loadProgressPlayer);
		_listener.onLoadInit = Delegate.create(this, _loadCompletePlayer);
		_mcl.addListener(_listener);
		_mcl.loadClip("http://youtube.com/v/" + myId, _mc);
		_oEB.dispatchEvent(new BasicEvent(PLAYERLOADER_IS_CLOSE));
	}

	public function release():Void {
		stopAllSounds();
		_mc.removeMovieClip();
		_mcl.removeListener(_listener);
		_oEB.dispatchEvent(new BasicEvent(PLAYERLOADER_IS_OPEN));
		super.release();
	}

}
</pre>
<p>To use it in flash :</p>
<pre langage="Actionscript">
import YoutubeLoader;
import com.bourre.commands.Delegate;
import com.bourre.events.NumberEvent;
import com.bourre.events.BasicEvent;

var myLoader:YoutubeLoader=new YoutubeLoader("THENAMEOFTHELOADERINSTANCE",this.createEmptyMovieClip("loadertest",this.getNextHighestDepth()));
myLoader.addEventListener(YoutubeLoader.LOAD_START,Delegate.create(this,_loadStart));
myLoader.addEventListener(YoutubeLoader.LOAD_PROGRESS,Delegate.create(this,_loadprogress));
myLoader.addEventListener(YoutubeLoader.LOAD_COMPLETE,Delegate.create(this,_loadComplete));
myLoader.addEventListener(YoutubeLoader.PLAYER_IS_READY,Delegate.create(this,_playerReady));
myLoader.addEventListener(YoutubeLoader.PLAYERLOADER_IS_OPEN,Delegate.create(this,_playerLoaderOpen));
myLoader.addEventListener(YoutubeLoader.PLAYERLOADER_IS_CLOSE,Delegate.create(this,_playerLoaderClose));
myLoader.open("37t52UpCaGE",200);
//myLoader.close();

function _loadStart(e:BasicEvent):Void{
	trace("_loadStart");
}

function _loadprogress(e:NumberEvent):Void{
	trace("_loadprogress"+e.getNumber());
}

function _loadComplete(e:BasicEvent):Void{
	trace("_loadComplete");
}

function _playerReady(e:BasicEvent):Void{
	trace("_playerReady");
}

function _playerLoaderOpen(e:BasicEvent):Void{
	trace("_playerLoaderOpen");
}

function _playerLoaderClose(e:BasicEvent):Void{
	trace("_playerLoaderClose");
}
</pre>
<p>Enjoy <img src='http://blog.makemepulse.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.makemepulse.com/2008/04/04/youtube-player-loader-class-in-as2/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Tips: Embed fonts and Input Textfield focus</title>
		<link>http://blog.makemepulse.com/2008/04/04/tips-embed-fonts-and-input-textfield-focus/</link>
		<comments>http://blog.makemepulse.com/2008/04/04/tips-embed-fonts-and-input-textfield-focus/#comments</comments>
		<pubDate>Fri, 04 Apr 2008 11:06:15 +0000</pubDate>
		<dc:creator>Jonathan Da Costa</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Flash CS3]]></category>
		<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://blog.makemepulse.com/2008/04/04/tips-embed-fonts-and-input-textfield-focus/</guid>
		<description><![CDATA[Anoying thing with dynamic input textfields in AS3: when adding the field in your stage without text, there&#8217;s no way to have any focus on it.

_field.type = TextFieldType.INPUT;
_field.selectable = true;
_field.embedFonts = true;

var format:TextFormat = new TextFormat();
format.font = "Myriad Pro";
format.size = 12;
format.color = 0x000000;

_field.antiAliasType=AntiAliasType.ADVANCED;
_field.setTextFormat(format);
addChild(_field);
Result: Impossible to put text in it.
A part of the solution is to [...]]]></description>
			<content:encoded><![CDATA[<p>Anoying thing with dynamic input textfields in AS3: when adding the field in your stage without text, there&#8217;s no way to have any focus on it.</p>
<pre>
_field.type = TextFieldType.INPUT;
_field.selectable = true;
_field.embedFonts = true;

var format:TextFormat = new TextFormat();
format.font = "Myriad Pro";
format.size = 12;
format.color = 0x000000;

_field.antiAliasType=AntiAliasType.ADVANCED;
_field.setTextFormat(format);
addChild(_field);</pre>
<p>Result: Impossible to put text in it.<br />
A part of the solution is to insert text before adding the field to the parent object.</p>
<pre>
_field.text="some text";
addChild(_field);</pre>
<p>You got it, focus is there, but you also have this very unusefull text.<br />
To resolve this problem, I used the Event.ADDED_TO_STAGE to clear text content.</p>
<pre>

_field.addEventListener(Event.ADDED_TO_STAGE, onAdd);

//then the listener handler

private function onAdd(evt:Event):void {
evt.currentTarget.text = "";
}</pre>
<p>Here you have a clean input textfield, with an embed font, mouse and tab focus. Cool hu ?</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.makemepulse.com/2008/04/04/tips-embed-fonts-and-input-textfield-focus/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>ComputeSpectrum &#8211; Violations and crashes</title>
		<link>http://blog.makemepulse.com/2008/03/03/computespectrum-violations-and-crashes/</link>
		<comments>http://blog.makemepulse.com/2008/03/03/computespectrum-violations-and-crashes/#comments</comments>
		<pubDate>Mon, 03 Mar 2008 14:30:18 +0000</pubDate>
		<dc:creator>Jonathan Da Costa</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://blog.makemepulse.com/2008/03/03/computespectrum-violations-and-crashes/</guid>
		<description><![CDATA[Working with ComputeSpectrum method is AS3 gives a lot of funny sound things but it also brings to top one of the worst ennemies of developers, that f**king sandbox security violation&#8230; Some facts: try to catch Computespectrum sound in your animation and run a Youtube video or anything containing flash sound in the same browser. [...]]]></description>
			<content:encoded><![CDATA[<p>Working with ComputeSpectrum method is AS3 gives a lot of funny sound things but it also brings to top one of the worst ennemies of developers, that f**king sandbox security violation&#8230; Some facts: try to catch Computespectrum sound in your animation and run a Youtube video or anything containing flash sound in the same browser. Two options: you&#8217;ve got Flash debugger installed, an error alert appears and that&#8217;s it, no more sound animation. You don&#8217;t have Flash debugger, the error occurs anyway but you don&#8217;t see anything (but the hidden flashlog knows).</p>
<p>I&#8217;ve spent a few hours looking for a way to proceed. Unfortunately, seems like there&#8217;s no distinction between the several movies played in the browser. Everything goes to the same global &#8220;channel&#8221; and there&#8217;s no need to set domain things or policy and allowed files. You just get an error, even if the played files are in the same folder&#8230;</p>
<p>What can I do  ?<br />
Obviously, you can try to catch the error.</p>
<p><code>try{<br />
SoundMixer.computeSpectrum( spect );<br />
} catch ( e:* ) {<br />
// here is the error, but you cannot avoid it.<br />
}<br />
</code></p>
<p>What else ? I don&#8217;t know. Is that an expected behaviour or just a future Flash 10 technote ? I hope so.<br />
(This post can be a good way to collect info about that point. Any ideas appreciated)</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.makemepulse.com/2008/03/03/computespectrum-violations-and-crashes/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Tips: Change PV3D material at runtime</title>
		<link>http://blog.makemepulse.com/2008/03/03/tips-change-pv3d-material-at-runtime/</link>
		<comments>http://blog.makemepulse.com/2008/03/03/tips-change-pv3d-material-at-runtime/#comments</comments>
		<pubDate>Mon, 03 Mar 2008 11:43:01 +0000</pubDate>
		<dc:creator>Jonathan Da Costa</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Papervision3D]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://blog.makemepulse.com/2008/03/03/tips-change-pv3d-material-at-runtime/</guid>
		<description><![CDATA[If you want to replace a material-list or just a material from a rendered object at runtime, you might have tried to remove the old material by the new instance like this:

myObj.materials = myNewMaterialsList;
Unfortunately, that doesn&#8217;t work (in PV3d 1, fixed by v2 if I&#8217;m not wrong) An other way to proceed is to use [...]]]></description>
			<content:encoded><![CDATA[<p>If you want to replace a material-list or just a material from a rendered object at runtime, you might have tried to remove the old material by the new instance like this:</p>
<pre>
myObj.materials = myNewMaterialsList;</pre>
<p>Unfortunately, that doesn&#8217;t work (in PV3d 1, fixed by v2 if I&#8217;m not wrong) An other way to proceed is to use bitmapMaterial and bitmapData.<br />
You just have to create a BitmapMaterial with a bitmapData inside:</p>
<pre>
var bd1:BitmapData=new BitmapData(100, 100, false, 0xFFFFFF);
var material2:BitmapMaterial = new BitmapMaterial(bd1);
material2.name="faceToSwitch"</pre>
<p>Then, swap the targeted material (alreday rendered) at runtime, on rollover action for example, simply by calling:</p>
<pre>
var bd2:BitmapData=new BitmapData(100, 100, false, 0x000000);
myObj.materials.getMaterialByName("faceToSwitch").bitmap = bd2;</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.makemepulse.com/2008/03/03/tips-change-pv3d-material-at-runtime/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tips:How to make the best portfolio ever</title>
		<link>http://blog.makemepulse.com/2008/02/21/tipshow-to-make-the-best-portfolio-ever/</link>
		<comments>http://blog.makemepulse.com/2008/02/21/tipshow-to-make-the-best-portfolio-ever/#comments</comments>
		<pubDate>Thu, 21 Feb 2008 14:44:55 +0000</pubDate>
		<dc:creator>Nicolas Rajabaly</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flash CS3]]></category>
		<category><![CDATA[Our lifes]]></category>
		<category><![CDATA[Papervision3D]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://blog.makemepulse.com/2008/02/21/tipshow-to-make-the-best-portfolio-ever/</guid>
		<description><![CDATA[ask jonathandc.com&#8230;

Big up to you Joni, your work is awesome   may be a &#8220;site of the day&#8221; by FWA
EDIT : PAPERVISION POWERED ! I hope that C4RL05 will enjoy it  
]]></description>
			<content:encoded><![CDATA[<p>ask <a href="http://www.jonathandc.com/">jonathandc.com</a>&#8230;</p>
<p style="text-align: center"><img src="http://blog.makemepulse.com/wp-content/uploads/2008/02/jdc.jpg" alt="Jony" /></p>
<p>Big up to you Joni, your work is awesome <img src='http://blog.makemepulse.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  may be a &#8220;site of the day&#8221; by <a href="http://www.thefwa.com/">FWA</a></p>
<p>EDIT : <a href="http://www.papervision3d.org/">PAPERVISION</a> POWERED ! I hope that <a href="http://blog.papervision3d.org/">C4RL05</a> will enjoy it <img src='http://blog.makemepulse.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.makemepulse.com/2008/02/21/tipshow-to-make-the-best-portfolio-ever/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Tips: How to deserialize an xml in object with pixlib</title>
		<link>http://blog.makemepulse.com/2008/02/19/tips-how-to-deserialize-an-xml-in-object-with-pixlib/</link>
		<comments>http://blog.makemepulse.com/2008/02/19/tips-how-to-deserialize-an-xml-in-object-with-pixlib/#comments</comments>
		<pubDate>Tue, 19 Feb 2008 12:34:42 +0000</pubDate>
		<dc:creator>Nicolas Rajabaly</dc:creator>
				<category><![CDATA[AS2]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flash 8]]></category>
		<category><![CDATA[Pixlib]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://blog.makemepulse.com/2008/02/19/tips-how-to-deserialize-an-xml-in-object-with-pixlib/</guid>
		<description><![CDATA[Pixlib is an AS 2.0 framework developed by Francis Bourre.
It&#8217;s designed to support event handling, logging, data préloading, managing sound and video, making transitions, data holders and data structures, patterns implementations&#8230; (more infos here).
The svn repository is here to download it.
Working with the childnodes syntax is always constraining. It&#8217;s why I prefer to deserialize my [...]]]></description>
			<content:encoded><![CDATA[<p>Pixlib is an AS 2.0 framework developed by <a href="http://www.tweenpix.net/blog/">Francis Bourre</a>.<br />
It&#8217;s designed to support event handling, logging, data préloading, managing sound and video, making transitions, data holders and data structures, patterns implementations&#8230; (more infos <a href="http://osflash.org/projects/pixlib">here</a>).<br />
The svn repository is <a href="http://svn1.cvsdude.com/osflash/pixlib/trunk/framework/">here</a> to download it.</p>
<p>Working with the childnodes syntax is always constraining. It&#8217;s why I prefer to deserialize my xml in object to work more easily.</p>
<p>For example with this xml :</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;config_flash<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;lang<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>fr<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/lang<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;country<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>fr<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/country<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;width<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>990<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/width<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;height<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>690<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/height<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;min_width<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>960<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/min_width<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;min_height<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>590<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/min_height<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;flash_version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>8<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/flash_version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;use_express_install</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;boolean&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>false<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/use_express_install<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;flash_bgcolor<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><span style="color: #339933;">&lt;![CDATA[#000000]]&gt;</span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/flash_bgcolor<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;swf_name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>loader<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/swf_name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;allow_languages<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;language</span> <span style="color: #000066;">c</span>=<span style="color: #ff0000;">&quot;uk&quot;</span> <span style="color: #000066;">l</span>=<span style="color: #ff0000;">&quot;en&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;language</span> <span style="color: #000066;">c</span>=<span style="color: #ff0000;">&quot;us&quot;</span> <span style="color: #000066;">l</span>=<span style="color: #ff0000;">&quot;en&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;language</span> <span style="color: #000066;">c</span>=<span style="color: #ff0000;">&quot;be&quot;</span> <span style="color: #000066;">l</span>=<span style="color: #ff0000;">&quot;du&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;language</span> <span style="color: #000066;">c</span>=<span style="color: #ff0000;">&quot;fr&quot;</span> <span style="color: #000066;">l</span>=<span style="color: #ff0000;">&quot;fr&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/allow_languages<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/config_flash<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>With the pixlib, I can simply deserialize it in object like this :</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">import</span> com.<span style="color: #006600;">bourre</span>.<span style="color: #0066CC;">data</span>.<span style="color: #006600;">libs</span>.<span style="color: #006600;">XMLToObject</span>;
<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">bourre</span>.<span style="color: #0066CC;">data</span>.<span style="color: #006600;">libs</span>.<span style="color: #006600;">XMLToObjectEvent</span>;
<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">bourre</span>.<span style="color: #0066CC;">data</span>.<span style="color: #006600;">libs</span>.<span style="color: #006600;">XMLToObjectDeserializer</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> _pixObj:<span style="color: #0066CC;">Object</span>;
<span style="color: #000000; font-weight: bold;">var</span> _path:<span style="color: #0066CC;">String</span>=<span style="color: #ff0000;">&quot;thexml.xml&quot;</span>;
<span style="color: #000000; font-weight: bold;">function</span> _loadXML<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Void</span><span style="color: #66cc66;">&#123;</span>
	XMLToObjectDeserializer.<span style="color: #006600;">PUSHINARRAY_IDENTICAL_NODE_NAMES</span> = <span style="color: #000000; font-weight: bold;">true</span>;
        XMLToObjectDeserializer.<span style="color: #006600;">DESERIALIZE_ATTRIBUTES</span> = <span style="color: #000000; font-weight: bold;">true</span>;
	<span style="color: #000000; font-weight: bold;">var</span> xto : XMLToObject = <span style="color: #000000; font-weight: bold;">new</span> XMLToObject<span style="color: #66cc66;">&#40;</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Object</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>;
	xto.<span style="color: #006600;">setAntiCache</span><span style="color: #66cc66;">&#40;</span> <span style="color: #000000; font-weight: bold;">false</span> <span style="color: #66cc66;">&#41;</span>;
	xto.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span> XMLToObject.<span style="color: #006600;">onLoadInitEVENT</span>, <span style="color: #0066CC;">this</span>, _onXmlDataLoad <span style="color: #66cc66;">&#41;</span>;
	xto.<span style="color: #0066CC;">load</span><span style="color: #66cc66;">&#40;</span> _path <span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> _onXmlDataLoad<span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">e</span> : XMLToObjectEvent <span style="color: #66cc66;">&#41;</span> : <span style="color: #0066CC;">Void</span> <span style="color: #66cc66;">&#123;</span>
	_pixObj=<span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Object</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
	_pixObj =  <span style="color: #0066CC;">e</span>.<span style="color: #006600;">getObject</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> ;	
         <span style="color: #0066CC;">trace</span> <span style="color: #66cc66;">&#40;</span>_pixObj.<span style="color: #006600;">lang</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// fr</span>
         <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span>pixObj.<span style="color: #006600;">min_width</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">//960</span>
         <span style="color: #0066CC;">trace</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">typeof</span><span style="color: #66cc66;">&#40;</span>_pixObj.<span style="color: #006600;">use_express_install</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">//boolean</span>
	 <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span>_pixObj.<span style="color: #006600;">allow_languages</span>.<span style="color: #0066CC;">language</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">c</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">//uk</span>
	<span style="color: #66cc66;">&#125;</span>
&nbsp;
_loadXML<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>As you can see in example, it&#8217;s very easy to use those class to deserialize an xml in object.<br />
The first step is to set some static var in the XMLToObjectDeserializer class.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">XMLToObjectDeserializer.<span style="color: #006600;">PUSHINARRAY_IDENTICAL_NODE_NAMES</span></pre></div></div>

<p> (default is false) make an array if they are identical node names in your xml. In the example, you can see that they are 4 &#8220;language&#8221; node and to access them you just have to manipulate the &#8220;langage&#8221; node as an array.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">XMLToObjectDeserializer.<span style="color: #006600;">DESERIALIZE_ATTRIBUTES</span></pre></div></div>

<p> (default is false) deserialize attributes. The node with attributes become an object.</p>
<p>With the attribute &#8220;type&#8221; you can force the typping of the nodeValue. For example :</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"> <span style="color: #0066CC;">trace</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">typeof</span><span style="color: #66cc66;">&#40;</span>_pixObj.<span style="color: #006600;">use_express_install</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">//Boolean</span></pre></div></div>

<p>Because the node was</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;use_express_install</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;boolean&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>false<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/use_express_install<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>but if the node is :</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;use_express_install</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;string&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>false<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/use_express_install<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"> <span style="color: #0066CC;">trace</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">typeof</span><span style="color: #66cc66;">&#40;</span>_pixObj.<span style="color: #006600;">use_express_install</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">//String</span></pre></div></div>

<p>After setting those vars, create an instance of XMLToObject and load the xml with the &#8220;load&#8221; method . You can set the anticache to true or false( a timestamp is added to the url of your xml if the anticache is true).<br />
If you want you have some events to listen during the loading of the xml :</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">XMLToObject.<span style="color: #006600;">onErrorEVENT</span>
XMLToObject.<span style="color: #006600;">onLoadInitEVENT</span>
XMLToObject.<span style="color: #006600;">onLoadProgressEVENT</span>
XMLToObject.<span style="color: #006600;">onTimeOutEVENT</span></pre></div></div>

<p>When the xml is loaded, you just have to push the result in an object and that&#8217;s all !</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.makemepulse.com/2008/02/19/tips-how-to-deserialize-an-xml-in-object-with-pixlib/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Tips : Find a file in subdirectory with FilterIterator in php</title>
		<link>http://blog.makemepulse.com/2008/02/19/tips-find-a-file-in-subdirectory-with-filteriterator-in-php/</link>
		<comments>http://blog.makemepulse.com/2008/02/19/tips-find-a-file-in-subdirectory-with-filteriterator-in-php/#comments</comments>
		<pubDate>Tue, 19 Feb 2008 11:13:35 +0000</pubDate>
		<dc:creator>Antoine Ughetto</dc:creator>
				<category><![CDATA[Php]]></category>
		<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://blog.makemepulse.com/2008/02/19/tips-find-a-file-in-subdirectory-with-filteriterator-in-php/</guid>
		<description><![CDATA[In my previous post Johannes Schlüte leave a comment which recommand me to use a filterIterator. I&#8217;m not really familiar with all the SPL capabilities but the best way to improve my knoweldge in SPL is to make test.
So, we have the same subdirectory than is the previus test. Here is the code :

include&#40;dirname&#40;__FILE__&#41;.&#34;/class.directorysearch.php&#34;&#41;;
&#160;
$directory = [...]]]></description>
			<content:encoded><![CDATA[<p>In my <a href="http://blog.makemepulse.com/2008/02/18/tips-easy-way-to-find-a-file-in-subdirectory-with-php/" target="_blank">previous post</a> <a href="http://schlueters.de" target="_blank">Johannes Schlüte</a> leave a comment which recommand me to use a <a href="http://www.php.net/~helly/php/ext/spl/protocolFilterIterator-p.html" target="_blank">filterIterator</a>. I&#8217;m not really familiar with all the SPL capabilities but the best way to improve my knoweldge in SPL is to make test.</p>
<p>So, we have the same subdirectory than is the previus test. Here is the code :</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">include</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">dirname</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">__FILE__</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;/class.directorysearch.php&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$directory</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> RecursiveIteratorIterator<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> RecursiveDirectoryIterator<span style="color: #009900;">&#40;</span><span style="color: #990000;">dirname</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">__FILE__</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;/directory&quot;</span><span style="color: #339933;">,</span>RecursiveDirectoryIterator<span style="color: #339933;">::</span><span style="color: #004000;">KEY_AS_FILENAME</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$search_directory</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> DirectorySearchIterator<span style="color: #009900;">&#40;</span><span style="color: #000088;">$directory</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;file_to_find.php&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;second_file.php&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$search_directory</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$test</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">include</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$search_directory</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>getPathName<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p><span id="more-82"></span>We pass to the DirectorySearchIterator class an instance of an Iterator (here the RecursiveIteratorIterator, but could be and ArrayIterator for example) and an array of values that must be find !</p>
<p>The DirectorySearchIterator extends the FilterIterator. We just have to define an accept method with the valid parameters!</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> DirectorySearchIterator <span style="color: #000000; font-weight: bold;">extends</span> FilterIterator<span style="color: #009900;">&#123;</span>    
&nbsp;
    <span style="color: #000000; font-weight: bold;">private</span>
      <span style="color: #000088;">$files_search</span><span style="color: #339933;">;</span>    
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> __construct<span style="color: #009900;">&#40;</span>Iterator <span style="color: #000088;">$iterator</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span> <span style="color: #000088;">$files</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>        
&nbsp;
        parent<span style="color: #339933;">::</span>__construct<span style="color: #009900;">&#40;</span><span style="color: #000088;">$iterator</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>files_search <span style="color: #339933;">=</span> <span style="color: #000088;">$files</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> accept<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
        <span style="color: #b1b100;">return</span> <span style="color: #990000;">in_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>current<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>files_search<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>I will make a test with the GlobIterator later&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.makemepulse.com/2008/02/19/tips-find-a-file-in-subdirectory-with-filteriterator-in-php/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Tips : Easy way to find a file in subdirectory with php</title>
		<link>http://blog.makemepulse.com/2008/02/18/tips-easy-way-to-find-a-file-in-subdirectory-with-php/</link>
		<comments>http://blog.makemepulse.com/2008/02/18/tips-easy-way-to-find-a-file-in-subdirectory-with-php/#comments</comments>
		<pubDate>Mon, 18 Feb 2008 15:12:58 +0000</pubDate>
		<dc:creator>Antoine Ughetto</dc:creator>
				<category><![CDATA[Php]]></category>
		<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://blog.makemepulse.com/2008/02/18/tips-easy-way-to-find-a-file-in-subdirectory-with-php/</guid>
		<description><![CDATA[I&#8217;ve made a previus post on SPL using RecursiveIterator to parse Array. Today we will use this same RecursiveIterator with a DirectoryRecursiveIterator.
We have a directory with a lot of subdirectory like this and we want to find this file   :


So we are just executing a page which must include the file_to_find.php :

include&#40;dirname&#40;__FILE__&#41;.&#34;/class.directorysearch.php&#34;&#41;;
&#160;
directory = [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve made a previus post on SPL <a href="http://blog.makemepulse.com/2008/02/11/tips-recursivearrayiterator-on-mulitdimensional-array/" target="_blank">using RecursiveIterator to parse Array.</a> Today we will use this same RecursiveIterator with a DirectoryRecursiveIterator.</p>
<p>We have a directory with a lot of subdirectory like this and we want to find this file <img src='http://blog.makemepulse.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  :</p>
<p style="text-align: center"><img src="http://blog.makemepulse.com/wp-content/uploads/2008/02/directories.gif" alt="Directories SPL" /></p>
<p align="left"><span id="more-80"></span></p>
<p>So we are just executing a page which must include the file_to_find.php :</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">include</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">dirname</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">__FILE__</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;/class.directorysearch.php&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
directory <span style="color: #339933;">=</span> <span style="color: #990000;">dirname</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">__FILE__</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;/directory&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$search_directory</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> DirectorySearch<span style="color: #009900;">&#40;</span><span style="color: #000088;">$directory</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
path_file <span style="color: #339933;">=</span> <span style="color: #000088;">$search_directory</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>find<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;file_to_find.php&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$path_file</span> <span style="color: #339933;">!==</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">include_once</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$path_file</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Let&#8217;s have a look to the class.directorysearch.php :</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> DirectorySearch  <span style="color: #009900;">&#123;</span>    
&nbsp;
<span style="color: #000000; font-weight: bold;">private</span>
      <span style="color: #000088;">$iterator</span><span style="color: #339933;">,</span>
      <span style="color: #000088;">$directoryname</span><span style="color: #339933;">;</span> 
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> __construct<span style="color: #009900;">&#40;</span><span style="color: #000088;">$directoryname</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>iterator <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> RecursiveIteratorIterator<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> RecursiveDirectoryIterator<span style="color: #009900;">&#40;</span><span style="color: #000088;">$directoryname</span><span style="color: #339933;">,</span>RecursiveDirectoryIterator<span style="color: #339933;">::</span><span style="color: #004000;">KEY_AS_FILENAME</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> find<span style="color: #009900;">&#40;</span><span style="color: #000088;">$filename</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>iterator <span style="color: #b1b100;">as</span> <span style="color: #000088;">$entry</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: #000088;">$filename</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>iterator<span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>current<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
            <span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>iterator<span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>getPathName<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
          <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>If we don&#8217;t use the KEY_AS_FILENAME  with the recursiveDirectoryIterator we will have the whole path of the file in $this-&gt;iterator-&gt;current();</p>
<p>All of this is a basic example of the RecursiveIteratorIterator with the RecursiveDirectoryIterator. SPL is a very powerfull toolkit !</p>
<p>Edit : <a href="http://blog.makemepulse.com/2008/02/19/tips-find-a-file-in-subdirectory-with-filteriterator-in-php/" target="_blank">http://blog.makemepulse.com/2008/02/19/tips-find-a-file-in-subdirectory-with-filteriterator-in-php/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.makemepulse.com/2008/02/18/tips-easy-way-to-find-a-file-in-subdirectory-with-php/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Tips: Using the Delegate class to manage scope</title>
		<link>http://blog.makemepulse.com/2008/02/18/tips-using-the-delegate-class-to-manage-scope/</link>
		<comments>http://blog.makemepulse.com/2008/02/18/tips-using-the-delegate-class-to-manage-scope/#comments</comments>
		<pubDate>Mon, 18 Feb 2008 12:41:36 +0000</pubDate>
		<dc:creator>Nicolas Rajabaly</dc:creator>
				<category><![CDATA[AS2]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flash 8]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://blog.makemepulse.com/2008/02/18/tips-using-the-delegate-class-to-manage-scope/</guid>
		<description><![CDATA[Basically, whenever you are passing around a Function object in Actionscript, that object is decoupled from whatever class it was written for. What this means that if that function has references to &#8220;this&#8221;, these references will refer to whichever object that will be the execution scope of the function when the function will execute.
For example, [...]]]></description>
			<content:encoded><![CDATA[<p>Basically, whenever you are passing around a Function object in Actionscript, that object is decoupled from whatever class it was written for. What this means that if that function has references to &#8220;this&#8221;, these references will refer to whichever object that will be the execution scope of the function when the function will execute.</p>
<p>For example, suppose you are creating a Mouse Listener :</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> mListener:<span style="color: #0066CC;">Object</span>=<span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Object</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
     mListener.<span style="color: #0066CC;">onMouseDown</span>=<span style="color: #000000; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Void</span><span style="color: #66cc66;">&#123;</span>
         <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span><span style="color: #66cc66;">&#41;</span> <span style="color: #808080; font-style: italic;">// [Object Object]</span>
    <span style="color: #66cc66;">&#125;</span>
    <span style="color: #0066CC;">Mouse</span>.<span style="color: #0066CC;">addListener</span><span style="color: #66cc66;">&#40;</span>mListener<span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>Here, &#8220;this&#8221; is a reference to the mouseListener<br />
but if you use the mx.utils.Delegate class :</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">utils</span>.<span style="color: #006600;">Delegate</span>;
<span style="color: #000000; font-weight: bold;">var</span> mListener:<span style="color: #0066CC;">Object</span>=<span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Object</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
     mListener.<span style="color: #0066CC;">onMouseDown</span>=Delegate.<span style="color: #006600;">create</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>,mousePressDown<span style="color: #66cc66;">&#41;</span>;
     <span style="color: #000000; font-weight: bold;">function</span> mousePressDown<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Void</span><span style="color: #66cc66;">&#123;</span>
        <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span><span style="color: #66cc66;">&#41;</span> <span style="color: #808080; font-style: italic;">// _level0</span>
    <span style="color: #66cc66;">&#125;</span>
    <span style="color: #0066CC;">Mouse</span>.<span style="color: #0066CC;">addListener</span><span style="color: #66cc66;">&#40;</span>mListener<span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>Here, &#8220;this&#8221; is a reference to the context of the mouse listener.</p>
<p>The Delegate class is used to specify this context(or scope). In the flash documentation you can read : &#8220;The Delegate class creates a function wrapper to let you run a function in the context of the original object, rather than in the context of the second object, when you pass a function from one object to another.&#8221;</p>
<p>If you open the class you will see (luckily, this class is only a few line long) :</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> mx.<span style="color: #006600;">utils</span>.<span style="color: #006600;">Delegate</span> <span style="color: #0066CC;">extends</span> <span style="color: #0066CC;">Object</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #808080; font-style: italic;">/**
	Creates a functions wrapper for the original function so that it runs 
	in the provided context.
	@parameter obj Context in which to run the function.
	@paramater func Function to run.
	*/</span>
	<span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">function</span> create<span style="color: #66cc66;">&#40;</span>obj:<span style="color: #0066CC;">Object</span>, func:<span style="color: #000000; font-weight: bold;">Function</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #000000; font-weight: bold;">Function</span>
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">var</span> f = <span style="color: #000000; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">target</span> = <span style="color: #0066CC;">arguments</span>.<span style="color: #0066CC;">callee</span>.<span style="color: #0066CC;">target</span>;
			<span style="color: #000000; font-weight: bold;">var</span> func = <span style="color: #0066CC;">arguments</span>.<span style="color: #0066CC;">callee</span>.<span style="color: #006600;">func</span>;
&nbsp;
			<span style="color: #b1b100;">return</span> func.<span style="color: #0066CC;">apply</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">target</span>, <span style="color: #0066CC;">arguments</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>;
&nbsp;
		f.<span style="color: #0066CC;">target</span> = obj;
		f.<span style="color: #006600;">func</span> = func;
&nbsp;
		<span style="color: #b1b100;">return</span> f;
	<span style="color: #66cc66;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">function</span> Delegate<span style="color: #66cc66;">&#40;</span>f:<span style="color: #000000; font-weight: bold;">Function</span><span style="color: #66cc66;">&#41;</span>
	<span style="color: #66cc66;">&#123;</span>
		func = f;
	<span style="color: #66cc66;">&#125;</span>
&nbsp;
	<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> func:<span style="color: #000000; font-weight: bold;">Function</span>;
&nbsp;
	<span style="color: #000000; font-weight: bold;">function</span> createDelegate<span style="color: #66cc66;">&#40;</span>obj:<span style="color: #0066CC;">Object</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #000000; font-weight: bold;">Function</span>
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #b1b100;">return</span> create<span style="color: #66cc66;">&#40;</span>obj, func<span style="color: #66cc66;">&#41;</span>;
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>In ActionScript, each function has a method &#8220;apply&#8221; which takes two arguments apply(scope, arguments), the scope of the function, and all arguments given to the function when the function is called.</p>
<p>The create() method of the class Delegate, takes two arguments, the scope in which the function will be executed and the function to execute and returns a reference to another function, which is a &#8220;wrapper&#8221; of the original.<br />
When the delegate is called, it simply executes the original function in the desired scope with the help of the apply method !<br />
It&#8217;s a static method, you did not need to create an instance of the Delegate object in order for it to work. You can simply call it directly as mx.utils.Delegate.create() which returned you the new &#8220;delegated&#8221; function.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.makemepulse.com/2008/02/18/tips-using-the-delegate-class-to-manage-scope/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>YUI Calendar, select a week !</title>
		<link>http://blog.makemepulse.com/2008/02/12/yui-calendar-select-a-week/</link>
		<comments>http://blog.makemepulse.com/2008/02/12/yui-calendar-select-a-week/#comments</comments>
		<pubDate>Tue, 12 Feb 2008 13:01:42 +0000</pubDate>
		<dc:creator>Antoine Ughetto</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[YUI team]]></category>

		<guid isPermaLink="false">http://blog.makemepulse.com/2008/02/12/yui-calendar-select-a-week/</guid>
		<description><![CDATA[Here is a smart example on how to select a week with the yui calendar
First we will create a simple calendar :

YAHOO.namespace&#40;&#34;example.calendar&#34;&#41;;YAHOO.example.calendar.init = function&#40;&#41; &#123;
      var today = new Date&#40;&#41;;
      YAHOO.example.calendar.cal1 = new YAHOO.widget.Calendar&#40;&#34;cal1&#34;,&#34;cal1Container&#34;, &#123;
            navigator:true,
   [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a smart example on how to select a week with the <a href="http://developer.yahoo.com/yui/calendar/" target="_blank">yui calendar</a></p>
<p>First we will create a simple calendar :</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">YAHOO.<span style="color: #003366; font-weight: bold;">namespace</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;example.calendar&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>YAHOO.<span style="color: #660066;">example</span>.<span style="color: #660066;">calendar</span>.<span style="color: #660066;">init</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> today <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Date<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      YAHOO.<span style="color: #660066;">example</span>.<span style="color: #660066;">calendar</span>.<span style="color: #660066;">cal1</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> YAHOO.<span style="color: #660066;">widget</span>.<span style="color: #660066;">Calendar</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;cal1&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;cal1Container&quot;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>
            navigator<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span>
            multi_select<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span>
            maxdate<span style="color: #339933;">:</span> <span style="color: #009900;">&#40;</span>today.<span style="color: #660066;">getMonth</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;/&quot;</span><span style="color: #339933;">+</span>today.<span style="color: #660066;">getDate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;/&quot;</span><span style="color: #339933;">+</span>today.<span style="color: #660066;">getFullYear</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>YAHOO.<span style="color: #660066;">example</span>.<span style="color: #660066;">calendar</span>.<span style="color: #660066;">cal1</span>.<span style="color: #660066;">render</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
YAHOO.<span style="color: #660066;">util</span>.<span style="color: #660066;">Event</span>.<span style="color: #660066;">onDOMReady</span><span style="color: #009900;">&#40;</span>YAHOO.<span style="color: #660066;">example</span>.<span style="color: #660066;">calendar</span>.<span style="color: #660066;">init</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>This will create a simple calendar.<span id="more-77"></span><br />
If we want to select a week, there is an easy way to select the cell of the clicked date and then to navigate throw parent nodes.</p>
<p>This method will get the selected date. We will go to the TR parent to get all the td nodes. With this solution and with the getDateByCellId we can get the first date of the week and the last. We then just have to execute the select function on this range.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> customClick <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>e<span style="color: #339933;">,</span> cal<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    YAHOO.<span style="color: #660066;">example</span>.<span style="color: #660066;">calendar</span>.<span style="color: #660066;">cal1</span>.<span style="color: #660066;">deselectAll</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #003366; font-weight: bold;">var</span> elem <span style="color: #339933;">=</span> YAHOO.<span style="color: #660066;">util</span>.<span style="color: #660066;">Event</span>.<span style="color: #660066;">getTarget</span><span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">while</span> <span style="color: #009900;">&#40;</span>elem.<span style="color: #660066;">tagName</span> <span style="color: #339933;">!=</span> <span style="color: #3366CC;">&quot;TR&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
          elem <span style="color: #339933;">=</span> elem.<span style="color: #660066;">parentNode</span><span style="color: #339933;">;</span>    
    <span style="color: #009900;">&#125;</span>
&nbsp;
    td_tochange <span style="color: #339933;">=</span> elem.<span style="color: #660066;">getElementsByTagName</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;td&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #003366; font-weight: bold;">var</span> date_start <span style="color: #339933;">=</span> YAHOO.<span style="color: #660066;">example</span>.<span style="color: #660066;">calendar</span>.<span style="color: #660066;">cal1</span>.<span style="color: #660066;">toDate</span><span style="color: #009900;">&#40;</span>YAHOO.<span style="color: #660066;">example</span>.<span style="color: #660066;">calendar</span>.<span style="color: #660066;">cal1</span>.<span style="color: #660066;">getDateByCellId</span><span style="color: #009900;">&#40;</span>td_tochange<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">id</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #003366; font-weight: bold;">var</span> date_end <span style="color: #339933;">=</span> YAHOO.<span style="color: #660066;">example</span>.<span style="color: #660066;">calendar</span>.<span style="color: #660066;">cal1</span>.<span style="color: #660066;">toDate</span><span style="color: #009900;">&#40;</span>YAHOO.<span style="color: #660066;">example</span>.<span style="color: #660066;">calendar</span>.<span style="color: #660066;">cal1</span>.<span style="color: #660066;">getDateByCellId</span><span style="color: #009900;">&#40;</span>td_tochange<span style="color: #009900;">&#91;</span>td_tochange.<span style="color: #660066;">length</span><span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">id</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #003366; font-weight: bold;">var</span> date_range <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>date_start.<span style="color: #660066;">getMonth</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #3366CC;">'/'</span><span style="color: #339933;">+</span>date_start.<span style="color: #660066;">getDate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;/&quot;</span><span style="color: #339933;">+</span>date_start.<span style="color: #660066;">getFullYear</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;-&quot;</span><span style="color: #339933;">+</span><span style="color: #009900;">&#40;</span>date_end.<span style="color: #660066;">getMonth</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #3366CC;">'/'</span><span style="color: #339933;">+</span>date_end.<span style="color: #660066;">getDate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;/&quot;</span><span style="color: #339933;">+</span>date_end.<span style="color: #660066;">getFullYear</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>YAHOO.<span style="color: #660066;">util</span>.<span style="color: #660066;">Dom</span>.<span style="color: #660066;">hasClass</span><span style="color: #009900;">&#40;</span>td_tochange<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;selected&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
 	YAHOO.<span style="color: #660066;">example</span>.<span style="color: #660066;">calendar</span>.<span style="color: #660066;">cal1</span>.<span style="color: #660066;">select</span><span style="color: #009900;">&#40;</span>date_range<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #000066; font-weight: bold;">else</span><span style="color: #009900;">&#123;</span>
 	YAHOO.<span style="color: #660066;">example</span>.<span style="color: #660066;">calendar</span>.<span style="color: #660066;">cal1</span>.<span style="color: #660066;">deselect</span><span style="color: #009900;">&#40;</span>date_range<span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#125;</span>
 YAHOO.<span style="color: #660066;">example</span>.<span style="color: #660066;">calendar</span>.<span style="color: #660066;">cal1</span>.<span style="color: #660066;">render</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span></pre></div></div>

<p>To enable the custom clik function we need to use the domEventMap on the calendar</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">YAHOO.<span style="color: #660066;">example</span>.<span style="color: #660066;">calendar</span>.<span style="color: #660066;">cal1</span>.<span style="color: #660066;">domEventMap</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
YAHOO.<span style="color: #660066;">example</span>.<span style="color: #660066;">calendar</span>.<span style="color: #660066;">cal1</span>.<span style="color: #660066;">domEventMap</span><span style="color: #009900;">&#91;</span>YAHOO.<span style="color: #660066;">example</span>.<span style="color: #660066;">calendar</span>.<span style="color: #660066;">cal1</span>.<span style="color: #660066;">Style</span>.<span style="color: #660066;">CSS_CELL_SELECTABLE</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>
 	<span style="color: #009900;">&#123;</span>tag<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">,</span> event<span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;click&quot;</span><span style="color: #339933;">,</span> handler<span style="color: #339933;">:</span> customClick<span style="color: #339933;">,</span> scope<span style="color: #339933;">:</span>YAHOO.<span style="color: #660066;">example</span>.<span style="color: #660066;">calendar</span>.<span style="color: #660066;">cal1</span><span style="color: #339933;">,</span> correct<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">false</span> <span style="color: #009900;">&#125;</span>
 	<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span></pre></div></div>

<p>You can simply <a href="http://dev.makemepulse.com/yui_calendar/" target="_blank">check the result here</a> and view the source code !</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.makemepulse.com/2008/02/12/yui-calendar-select-a-week/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Tips : RecursiveArrayIterator on mulitdimensional Array</title>
		<link>http://blog.makemepulse.com/2008/02/11/tips-recursivearrayiterator-on-mulitdimensional-array/</link>
		<comments>http://blog.makemepulse.com/2008/02/11/tips-recursivearrayiterator-on-mulitdimensional-array/#comments</comments>
		<pubDate>Mon, 11 Feb 2008 15:10:56 +0000</pubDate>
		<dc:creator>Antoine Ughetto</dc:creator>
				<category><![CDATA[Php]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://blog.makemepulse.com/2008/02/11/tips-recursivearrayiterator-on-mulitdimensional-array/</guid>
		<description><![CDATA[When we have a multidimensional array we have to make some recursives function to parse it. A simple way to get the keys and the value of this type of array is to use the SPL library of PHP.
To do this we will use a RecursiveArrayIterator and a RecursiveIteratorIterator


$array_multi = array&#40; 
    [...]]]></description>
			<content:encoded><![CDATA[<p>When we have a multidimensional array we have to make some recursives function to parse it. A simple way to get the keys and the value of this type of array is to use the <a href="http://fr2.php.net/manual/fr/ref.spl.php" target="_blank">SPL library of PHP</a>.</p>
<p>To do this we will use a <a href="http://www.php.net/~helly/php/ext/spl/classRecursiveArrayIterator.html" target="_blank">RecursiveArrayIterator</a> and a <a href="http://www.php.net/~helly/php/ext/spl/classRecursiveIteratorIterator.html" target="_blank">RecursiveIteratorIterator</a><br />
<span id="more-75"></span></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$array_multi</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> 
      <span style="color: #0000ff;">&quot;myKey&quot;</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">&quot;myValue&quot;</span><span style="color: #339933;">,</span>
      <span style="color: #0000ff;">&quot;myKey2&quot;</span><span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
                   <span style="color: #0000ff;">&quot;myKey2Array&quot;</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">&quot;value2Array&quot;</span><span style="color: #339933;">,</span>
                   <span style="color: #0000ff;">&quot;myKey3Array&quot;</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">&quot;value3Array&quot;</span><span style="color: #339933;">,</span>
                   <span style="color: #0000ff;">&quot;myKey4Array&quot;</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">&quot;value4Array&quot;</span><span style="color: #339933;">,</span>
                   <span style="color: #0000ff;">&quot;myKey5Array&quot;</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;test&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;tata&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;france&quot;</span><span style="color: #009900;">&#41;</span>
                     <span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$array_iterator</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> RecursiveIteratorIterator<span style="color: #009900;">&#40;</span>
                     <span style="color: #000000; font-weight: bold;">new</span> RecursiveArrayIterator<span style="color: #009900;">&#40;</span><span style="color: #000088;">$array_multi</span><span style="color: #009900;">&#41;</span>
                  <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$array_iterator</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$key</span><span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span><span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
     <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$key</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' -- '</span><span style="color: #339933;">.</span><span style="color: #000088;">$value</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'
'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>This simple code will just output all the keys/value of the array :</p>
<p>myKey &#8212; myValue<br />
myKey2Array &#8212; value2Array<br />
myKey3Array &#8212; value3Array<br />
myKey4Array &#8212; value4Array<br />
0 &#8212; test<br />
1 &#8212; tata<br />
2 &#8212; france</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.makemepulse.com/2008/02/11/tips-recursivearrayiterator-on-mulitdimensional-array/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>
