<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Commentaires sur : Routez vos visiteurs !</title>
	<atom:link href="http://www.pierre-martin.fr/2009/11/09/routez-vos-visiteurs/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.pierre-martin.fr/2009/11/09/routez-vos-visiteurs/</link>
	<description>Astuces liées au quotidien du développement web PHP avec CakePHP</description>
	<lastBuildDate>Tue, 27 Sep 2011 09:00:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
	<item>
		<title>Par : Rob2</title>
		<link>http://www.pierre-martin.fr/2009/11/09/routez-vos-visiteurs/comment-page-1/#comment-1535</link>
		<dc:creator>Rob2</dc:creator>
		<pubDate>Thu, 04 Mar 2010 18:22:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.pierre-martin.fr/?p=508#comment-1535</guid>
		<description>Eh ben en fait toujours pas, je suis redirigé sur &lt;a href=&quot;http://127.0.0.1/cakephp/cakephp/connexion&quot; rel=&quot;nofollow&quot;&gt;http://127.0.0.1/cakephp/cakephp/connexion&lt;/a&gt; au lieu de &lt;a href=&quot;http://127.0.0.1/cakephp/connexion&quot; rel=&quot;nofollow&quot;&gt;http://127.0.0.1/cakephp/connexion&lt;/a&gt; :/</description>
		<content:encoded><![CDATA[<p>Eh ben en fait toujours pas, je suis redirigé sur <a href="http://127.0.0.1/cakephp/cakephp/connexion" rel="nofollow">http://127.0.0.1/cakephp/cakephp/connexion</a> au lieu de <a href="http://127.0.0.1/cakephp/connexion" rel="nofollow">http://127.0.0.1/cakephp/connexion</a> :/</p>
]]></content:encoded>
	</item>
	<item>
		<title>Par : Pierre Martin</title>
		<link>http://www.pierre-martin.fr/2009/11/09/routez-vos-visiteurs/comment-page-1/#comment-1534</link>
		<dc:creator>Pierre Martin</dc:creator>
		<pubDate>Thu, 04 Mar 2010 17:18:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.pierre-martin.fr/?p=508#comment-1534</guid>
		<description>Non, cela devrait fonctionner mais j&#039;ai tellement pris l&#039;habitude d&#039;avoir ma propre methode isRequestedAction() que je n&#039;avais pas fait attention a elle !&lt;br&gt;&lt;br&gt;Le RequestHandler est un composant a ajouter a vos controleurs si vous faites de l&#039;AJAX ou du REST. Il aide a gerer les differents types d&#039;appels de page.&lt;br&gt;&lt;br&gt;La partie importante du &quot;if&quot; est &quot;$this-&gt;here != $url&quot; ... le reste ce n&#039;est que pour se parer des problemes pouvant survenir lors de requestAction ou d&#039;appels Ajax, donc cela peut etre supprime si ils ne sont pas utilises.</description>
		<content:encoded><![CDATA[<p>Non, cela devrait fonctionner mais j&#39;ai tellement pris l&#39;habitude d&#39;avoir ma propre methode isRequestedAction() que je n&#39;avais pas fait attention a elle !</p>
<p>Le RequestHandler est un composant a ajouter a vos controleurs si vous faites de l&#39;<acronym title="Asynchronous JavaScript and XML">AJAX</acronym> ou du REST. Il aide a gerer les differents types d&#39;appels de page.</p>
<p>La partie importante du &laquo;&nbsp;if&nbsp;&raquo; est &laquo;&nbsp;$this-&gt;here != $url&nbsp;&raquo; &#8230; le reste ce n&#39;est que pour se parer des problemes pouvant survenir lors de requestAction ou d&#39;appels Ajax, donc cela peut etre supprime si ils ne sont pas utilises.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Par : Rob2</title>
		<link>http://www.pierre-martin.fr/2009/11/09/routez-vos-visiteurs/comment-page-1/#comment-1533</link>
		<dc:creator>Rob2</dc:creator>
		<pubDate>Thu, 04 Mar 2010 15:37:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.pierre-martin.fr/?p=508#comment-1533</guid>
		<description>Merci d&#039;avoir revu le code :)&lt;br&gt;Par contre j&#039;utilise CakePHP 1.2.6, donc ça ne marche toujours pas ^^&lt;br&gt;Un debug($url); me renvoie /cakephp/inscription et j&#039;obtiens l&#039;erreur suivante : Fatal error: Call to undefined method UsersController::isRequestedAction()&lt;br&gt;Je suppose que ça fait pareil pour $this-&gt;RequestHandler...</description>
		<content:encoded><![CDATA[<p>Merci d&#39;avoir revu le code <img src='http://www.pierre-martin.fr/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> <br />Par contre j&#39;utilise CakePHP 1.2.6, donc ça ne marche toujours pas ^^<br />Un debug($url); me renvoie /cakephp/inscription et j&#39;obtiens l&#39;erreur suivante : Fatal error: Call to undefined method UsersController::isRequestedAction()<br />Je suppose que ça fait pareil pour $this-&gt;RequestHandler&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>Par : Pierre Martin</title>
		<link>http://www.pierre-martin.fr/2009/11/09/routez-vos-visiteurs/comment-page-1/#comment-1532</link>
		<dc:creator>Pierre Martin</dc:creator>
		<pubDate>Thu, 04 Mar 2010 01:30:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.pierre-martin.fr/?p=508#comment-1532</guid>
		<description>Merci pour cette remarque et ces informations ...&lt;br&gt;En effet, le code fournit ne marchait pas dans le cas ou Cake etait dans un sous-dossier.&lt;br&gt;&lt;br&gt;Au final, je pense que le code suivant (encore plus simple ;) ) devrait faire l&#039;affaire dans tous les cas d&#039;utilisation, j&#039;ai rapidement teste avec CakePHP 1.3RC1.&lt;br&gt;&lt;br&gt;&lt;pre&gt;&lt;br&gt;	protected function _checkRoute() {&lt;br&gt;		$url = Router::url($this-&gt;passedArgs);&lt;br&gt;		&lt;br&gt;		if ($this-&gt;here != $url &amp;&amp; !$this-&gt;isRequestedAction() &amp;&amp; !$this-&gt;RequestHandler-&gt;isAjax()) {&lt;br&gt;			$this-&gt;redirect($url, 301);&lt;br&gt;		}&lt;br&gt;	}&lt;br&gt;&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Merci pour cette remarque et ces informations &#8230;<br />En effet, le code fournit ne marchait pas dans le cas ou Cake etait dans un sous-dossier.</p>
<p>Au final, je pense que le code suivant (encore plus simple <img src='http://www.pierre-martin.fr/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  ) devrait faire l&#39;affaire dans tous les cas d&#39;utilisation, j&#39;ai rapidement teste avec CakePHP 1.3RC1.</p>
<pre>	protected function _checkRoute() {		$url = Router::url($this-&gt;passedArgs);

		if ($this-&gt;here != $url &#038;&#038; !$this-&gt;isRequestedAction() &#038;&#038; !$this-&gt;RequestHandler-&gt;isAjax()) {			$this-&gt;redirect($url, 301);		}	}</pre>
]]></content:encoded>
	</item>
	<item>
		<title>Par : Rob2</title>
		<link>http://www.pierre-martin.fr/2009/11/09/routez-vos-visiteurs/comment-page-1/#comment-1531</link>
		<dc:creator>Rob2</dc:creator>
		<pubDate>Tue, 02 Mar 2010 19:19:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.pierre-martin.fr/?p=508#comment-1531</guid>
		<description>J&#039;ai bien installé CakePHP sans le sous-dossier &quot;cakephp&quot;, j&#039;y accède avec l&#039;url &lt;a href=&quot;http://127.0.0.1/cakephp/&quot; rel=&quot;nofollow&quot;&gt;http://127.0.0.1/cakephp/&lt;/a&gt;&lt;br&gt;Le debug donne :&lt;br&gt;Array&lt;br&gt;(&lt;br&gt;    [pass] =&gt; Array&lt;br&gt;        (&lt;br&gt;        )&lt;br&gt;&lt;br&gt;    [named] =&gt; Array&lt;br&gt;        (&lt;br&gt;        )&lt;br&gt;&lt;br&gt;    [controller] =&gt; cakephp&lt;br&gt;    [plugin] =&gt; &lt;br&gt;    [action] =&gt; index&lt;br&gt;)</description>
		<content:encoded><![CDATA[<p>J&#39;ai bien installé CakePHP sans le sous-dossier &laquo;&nbsp;cakephp&nbsp;&raquo;, j&#39;y accède avec l&#39;url <a href="http://127.0.0.1/cakephp/" rel="nofollow">http://127.0.0.1/cakephp/</a><br />Le debug donne :<br />Array<br />(<br />    [pass] =&gt; Array<br />        (<br />        )</p>
<p>    [named] =&gt; Array<br />        (<br />        )</p>
<p>    [controller] =&gt; cakephp<br />    [plugin] =&gt; <br />    [action] =&gt; index<br />)</p>
]]></content:encoded>
	</item>
	<item>
		<title>Par : Pierre Martin</title>
		<link>http://www.pierre-martin.fr/2009/11/09/routez-vos-visiteurs/comment-page-1/#comment-1530</link>
		<dc:creator>Pierre Martin</dc:creator>
		<pubDate>Tue, 02 Mar 2010 13:18:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.pierre-martin.fr/?p=508#comment-1530</guid>
		<description>Ah, je n&#039;ai pas teste ce code depuis un sous-dossier du domaine principal ... cela vient peut-etre de la.&lt;br&gt;Que donne un debug($urlParts); ?&lt;br&gt;&lt;br&gt;Peux tu confirmer que tu as installe ton application CakePHP dans le sous-dossier &quot;cakephp&quot; de l&#039;espace web ? (et donc que &lt;a href=&quot;http://localhost/cakephp&quot; rel=&quot;nofollow&quot;&gt;http://localhost/cakephp&lt;/a&gt; est la page d&#039;accueil de l&#039;application)</description>
		<content:encoded><![CDATA[<p>Ah, je n&#39;ai pas teste ce code depuis un sous-dossier du domaine principal &#8230; cela vient peut-etre de la.<br />Que donne un debug($urlParts); ?</p>
<p>Peux tu confirmer que tu as installe ton application CakePHP dans le sous-dossier &laquo;&nbsp;cakephp&nbsp;&raquo; de l&#39;espace web ? (et donc que <a href="http://localhost/cakephp" rel="nofollow">http://localhost/cakephp</a> est la page d&#39;accueil de l&#39;application)</p>
]]></content:encoded>
	</item>
	<item>
		<title>Par : Rob2</title>
		<link>http://www.pierre-martin.fr/2009/11/09/routez-vos-visiteurs/comment-page-1/#comment-1529</link>
		<dc:creator>Rob2</dc:creator>
		<pubDate>Wed, 24 Feb 2010 18:57:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.pierre-martin.fr/?p=508#comment-1529</guid>
		<description>debug($this-&gt;here) donne :&lt;br&gt;/cakephp/&lt;br&gt;debug($url) donne :&lt;br&gt;Array&lt;br&gt;(&lt;br&gt;    [controller] =&gt; cakephp&lt;br&gt;    [plugin] =&gt; &lt;br&gt;    [action] =&gt; index&lt;br&gt;)&lt;br&gt;J&#039;accède à CakePHP avec l&#039;url : &lt;a href=&quot;http://127.0.0.1/cakephp/&quot; rel=&quot;nofollow&quot;&gt;http://127.0.0.1/cakephp/&lt;/a&gt; et il me redirige vers &lt;a href=&quot;http://127.0.0.1/cakephp/cakephp&quot; rel=&quot;nofollow&quot;&gt;http://127.0.0.1/cakephp/cakephp&lt;/a&gt;, avec une erreur car le contrôleur cakephp n&#039;existe pas...</description>
		<content:encoded><![CDATA[<p>debug($this-&gt;here) donne :<br />/cakephp/<br />debug($url) donne :<br />Array<br />(<br />    [controller] =&gt; cakephp<br />    [plugin] =&gt; <br />    [action] =&gt; index<br />)<br />J&#39;accède à CakePHP avec l&#39;url : <a href="http://127.0.0.1/cakephp/" rel="nofollow">http://127.0.0.1/cakephp/</a> et il me redirige vers <a href="http://127.0.0.1/cakephp/cakephp" rel="nofollow">http://127.0.0.1/cakephp/cakephp</a>, avec une erreur car le contrôleur cakephp n&#39;existe pas&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>Par : Pierre Martin</title>
		<link>http://www.pierre-martin.fr/2009/11/09/routez-vos-visiteurs/comment-page-1/#comment-1528</link>
		<dc:creator>Pierre Martin</dc:creator>
		<pubDate>Wed, 24 Feb 2010 01:12:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.pierre-martin.fr/?p=508#comment-1528</guid>
		<description>As-tu essayé de débugguer le code pour voir ce qui bloquait ?&lt;br&gt;Que donnent les debug suivants si (en les mettant dans _checkRoute juste avant le if) ?&lt;br&gt;&lt;pre lang=&quot;php&quot;&gt;&lt;br&gt;debug($this-&gt;here);&lt;br&gt;debug($url);&lt;br&gt;&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>As-tu essayé de débugguer le code pour voir ce qui bloquait ?<br />Que donnent les debug suivants si (en les mettant dans _checkRoute juste avant le if) ?</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>br<span style="color: #339933;">&gt;</span>debug<span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>here<span style="color: #009900;">&#41;</span><span style="color: #339933;">;&lt;</span>br<span style="color: #339933;">&gt;</span>debug<span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;&lt;</span>br<span style="color: #339933;">&gt;</span></pre></div></div>

]]></content:encoded>
	</item>
	<item>
		<title>Par : Rob2</title>
		<link>http://www.pierre-martin.fr/2009/11/09/routez-vos-visiteurs/comment-page-1/#comment-1527</link>
		<dc:creator>Rob2</dc:creator>
		<pubDate>Tue, 23 Feb 2010 21:34:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.pierre-martin.fr/?p=508#comment-1527</guid>
		<description>Ça ne marche pas pour moi, aucune redirection n&#039;est faite...</description>
		<content:encoded><![CDATA[<p>Ça ne marche pas pour moi, aucune redirection n&#39;est faite&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>Par : CakePHP : signets remarquables du 06/11/2009 au 09/11/2009 &#124; Cherry on the...</title>
		<link>http://www.pierre-martin.fr/2009/11/09/routez-vos-visiteurs/comment-page-1/#comment-1098</link>
		<dc:creator>CakePHP : signets remarquables du 06/11/2009 au 09/11/2009 &#124; Cherry on the...</dc:creator>
		<pubDate>Mon, 09 Nov 2009 10:01:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.pierre-martin.fr/?p=508#comment-1098</guid>
		<description>[...] Routez vos visiteurs ! [...]</description>
		<content:encoded><![CDATA[<p>[...] Routez vos visiteurs ! [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>

