<?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>Comments on: A simple redirect component</title>
	<atom:link href="http://cakebaker.42dh.com/2006/03/28/a-simple-redirect-component/feed/" rel="self" type="application/rss+xml" />
	<link>http://cakebaker.42dh.com/2006/03/28/a-simple-redirect-component/</link>
	<description>baking cakes with CakePHP</description>
	<lastBuildDate>Tue, 16 Mar 2010 17:17:53 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: cakebaker</title>
		<link>http://cakebaker.42dh.com/2006/03/28/a-simple-redirect-component/comment-page-1/#comment-141393</link>
		<dc:creator>cakebaker</dc:creator>
		<pubDate>Sat, 05 Dec 2009 14:30:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.cakebaker.42dh.com/?p=153#comment-141393</guid>
		<description>@pb: Thanks for the hint, I fixed it in the article.</description>
		<content:encoded><![CDATA[<p>@pb: Thanks for the hint, I fixed it in the article.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pb</title>
		<link>http://cakebaker.42dh.com/2006/03/28/a-simple-redirect-component/comment-page-1/#comment-141239</link>
		<dc:creator>pb</dc:creator>
		<pubDate>Fri, 04 Dec 2009 01:13:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.cakebaker.42dh.com/?p=153#comment-141239</guid>
		<description>Hi

To prevent any possible javascript injection problems
escape the url with json_encode
This way, you&#039;re sure the $url won&#039;t break the javascript syntax

echo ‘window.location = &#039;.json_encode($url);

Cheers</description>
		<content:encoded><![CDATA[<p>Hi</p>
<p>To prevent any possible javascript injection problems<br />
escape the url with json_encode<br />
This way, you&#8217;re sure the $url won&#8217;t break the javascript syntax</p>
<p>echo ‘window.location = &#8216;.json_encode($url);</p>
<p>Cheers</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cakebaker</title>
		<link>http://cakebaker.42dh.com/2006/03/28/a-simple-redirect-component/comment-page-1/#comment-137229</link>
		<dc:creator>cakebaker</dc:creator>
		<pubDate>Sun, 27 Sep 2009 12:24:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.cakebaker.42dh.com/?p=153#comment-137229</guid>
		<description>@Shaun: You are welcome!</description>
		<content:encoded><![CDATA[<p>@Shaun: You are welcome!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shaun</title>
		<link>http://cakebaker.42dh.com/2006/03/28/a-simple-redirect-component/comment-page-1/#comment-137165</link>
		<dc:creator>Shaun</dc:creator>
		<pubDate>Sat, 26 Sep 2009 12:04:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.cakebaker.42dh.com/?p=153#comment-137165</guid>
		<description>@nnc:  Thanks for the simplification.  I was planning on putting the javascript code at the top of all my layouts until I read your comment.

@cakebaker:  Thanks for the original idea.  I haven&#039;t been able to find any server-side solutions that work correctly.</description>
		<content:encoded><![CDATA[<p>@nnc:  Thanks for the simplification.  I was planning on putting the javascript code at the top of all my layouts until I read your comment.</p>
<p>@cakebaker:  Thanks for the original idea.  I haven&#8217;t been able to find any server-side solutions that work correctly.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cakebaker</title>
		<link>http://cakebaker.42dh.com/2006/03/28/a-simple-redirect-component/comment-page-1/#comment-65645</link>
		<dc:creator>cakebaker</dc:creator>
		<pubDate>Tue, 12 Feb 2008 16:25:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.cakebaker.42dh.com/?p=153#comment-65645</guid>
		<description>@Aaron: Hm, strange, it works here. It looks like the controller is not set. Does the startup() method get called?</description>
		<content:encoded><![CDATA[<p>@Aaron: Hm, strange, it works here. It looks like the controller is not set. Does the startup() method get called?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aaron</title>
		<link>http://cakebaker.42dh.com/2006/03/28/a-simple-redirect-component/comment-page-1/#comment-65445</link>
		<dc:creator>Aaron</dc:creator>
		<pubDate>Tue, 12 Feb 2008 01:25:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.cakebaker.42dh.com/?p=153#comment-65445</guid>
		<description>When I run this code, I get the following error:

Fatal error: Call to a member function redirect() on a non-object in /path/to/app/controllers/components/component.php on line 18

Line 18, in my case is:

$this-&gt;controller-&gt;redirect(&#039;/users/login&#039;);

Any ideas?  I&#039;m pulling my hair out.</description>
		<content:encoded><![CDATA[<p>When I run this code, I get the following error:</p>
<p>Fatal error: Call to a member function redirect() on a non-object in /path/to/app/controllers/components/component.php on line 18</p>
<p>Line 18, in my case is:</p>
<p>$this-&gt;controller-&gt;redirect(&#8216;/users/login&#8217;);</p>
<p>Any ideas?  I&#8217;m pulling my hair out.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cakebaker</title>
		<link>http://cakebaker.42dh.com/2006/03/28/a-simple-redirect-component/comment-page-1/#comment-6582</link>
		<dc:creator>cakebaker</dc:creator>
		<pubDate>Wed, 16 May 2007 09:12:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.cakebaker.42dh.com/?p=153#comment-6582</guid>
		<description>@nnc: Thanks for the addition.</description>
		<content:encoded><![CDATA[<p>@nnc: Thanks for the addition.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nnc</title>
		<link>http://cakebaker.42dh.com/2006/03/28/a-simple-redirect-component/comment-page-1/#comment-6560</link>
		<dc:creator>nnc</dc:creator>
		<pubDate>Tue, 15 May 2007 08:41:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.cakebaker.42dh.com/?p=153#comment-6560</guid>
		<description>If all you want to do is redirect, I find it much more convenient to eliminate  if (isset($url)) from views. To do that, I modified goto function to following:

	function goto($url)
	{
		if ($this-&gt;RequestHandler-&gt;isAjax()) {
			echo &#039;&#039;;
			echo &#039;window.location = &quot;&#039;.$url.&#039;&quot;&#039;;
			echo &#039;&#039;;
			exit();
		} else {
			$this-&gt;controller-&gt;redirect($url);
		}
	}

I use this in admin section to redirect to login form if session has expired.

Thanks for this great site cakebaker.</description>
		<content:encoded><![CDATA[<p>If all you want to do is redirect, I find it much more convenient to eliminate  if (isset($url)) from views. To do that, I modified goto function to following:</p>
<p>	function goto($url)<br />
	{<br />
		if ($this-&gt;RequestHandler-&gt;isAjax()) {<br />
			echo &#8221;;<br />
			echo &#8216;window.location = &#8220;&#8216;.$url.&#8217;&#8221;&#8216;;<br />
			echo &#8221;;<br />
			exit();<br />
		} else {<br />
			$this-&gt;controller-&gt;redirect($url);<br />
		}<br />
	}</p>
<p>I use this in admin section to redirect to login form if session has expired.</p>
<p>Thanks for this great site cakebaker.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cakebaker</title>
		<link>http://cakebaker.42dh.com/2006/03/28/a-simple-redirect-component/comment-page-1/#comment-373</link>
		<dc:creator>cakebaker</dc:creator>
		<pubDate>Tue, 28 Mar 2006 16:32:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.cakebaker.42dh.com/?p=153#comment-373</guid>
		<description>The startup function is automatically called by Cake, you do not have to call it yourself.</description>
		<content:encoded><![CDATA[<p>The startup function is automatically called by Cake, you do not have to call it yourself.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nao</title>
		<link>http://cakebaker.42dh.com/2006/03/28/a-simple-redirect-component/comment-page-1/#comment-372</link>
		<dc:creator>Nao</dc:creator>
		<pubDate>Tue, 28 Mar 2006 16:17:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.cakebaker.42dh.com/?p=153#comment-372</guid>
		<description>We must call it manually before redirect, it right ?</description>
		<content:encoded><![CDATA[<p>We must call it manually before redirect, it right ?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
