<?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: Url Routing with PHP &#8211; Part Two</title>
	<atom:link href="http://www.phpaddiction.com/tags/php/url-routing-with-php-part-two/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.phpaddiction.com/tags/php/url-routing-with-php-part-two/</link>
	<description></description>
	<lastBuildDate>Thu, 08 Jul 2010 03:46:12 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: Anonymous</title>
		<link>http://www.phpaddiction.com/tags/php/url-routing-with-php-part-two/comment-page-1/#comment-101084</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Sat, 29 May 2010 14:40:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpaddiction.com/tags/php/url-routing-with-php-part-two/#comment-101084</guid>
		<description>Great Article.
&lt;code&gt;
//
//    Shorter way of parsing the path.
//
array_diff (
    explode(&#039;/&#039;, $_SERVER[&#039;REQUEST_URI&#039;]),
    explode(&#039;/&#039;, $_SERVER[&#039;SCRIPT_NAME&#039;])
);

&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>Great Article.<br />
<code><br />
//<br />
//    Shorter way of parsing the path.<br />
//<br />
array_diff (<br />
    explode('/', $_SERVER['REQUEST_URI']),<br />
    explode('/', $_SERVER['SCRIPT_NAME'])<br />
);</p>
<p></code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: IT Support London</title>
		<link>http://www.phpaddiction.com/tags/php/url-routing-with-php-part-two/comment-page-1/#comment-59224</link>
		<dc:creator>IT Support London</dc:creator>
		<pubDate>Tue, 24 Nov 2009 13:21:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpaddiction.com/tags/php/url-routing-with-php-part-two/#comment-59224</guid>
		<description>i cant get the code to work arghhhh!</description>
		<content:encoded><![CDATA[<p>i cant get the code to work arghhhh!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: vulo</title>
		<link>http://www.phpaddiction.com/tags/php/url-routing-with-php-part-two/comment-page-1/#comment-50727</link>
		<dc:creator>vulo</dc:creator>
		<pubDate>Tue, 06 Oct 2009 02:40:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpaddiction.com/tags/php/url-routing-with-php-part-two/#comment-50727</guid>
		<description>While using the url router, 
in the functions that I am using instead of variables I get 

AC_RunActiveContent.js
Scripts
robots.txt, loaded into the urls - array
and the the actual url (for example - events, ot contacts)

Also I think it is reloading the page every time. with these values into the urls - array

Have anyone idea why this is happening.
Regards
Vulo</description>
		<content:encoded><![CDATA[<p>While using the url router,<br />
in the functions that I am using instead of variables I get </p>
<p>AC_RunActiveContent.js<br />
Scripts<br />
robots.txt, loaded into the urls &#8211; array<br />
and the the actual url (for example &#8211; events, ot contacts)</p>
<p>Also I think it is reloading the page every time. with these values into the urls &#8211; array</p>
<p>Have anyone idea why this is happening.<br />
Regards<br />
Vulo</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stunaz</title>
		<link>http://www.phpaddiction.com/tags/php/url-routing-with-php-part-two/comment-page-1/#comment-44676</link>
		<dc:creator>stunaz</dc:creator>
		<pubDate>Wed, 29 Jul 2009 09:00:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpaddiction.com/tags/php/url-routing-with-php-part-two/#comment-44676</guid>
		<description>i mean in the example that we download from the link</description>
		<content:encoded><![CDATA[<p>i mean in the example that we download from the link</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stunaz</title>
		<link>http://www.phpaddiction.com/tags/php/url-routing-with-php-part-two/comment-page-1/#comment-44674</link>
		<dc:creator>stunaz</dc:creator>
		<pubDate>Wed, 29 Jul 2009 08:41:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpaddiction.com/tags/php/url-routing-with-php-part-two/#comment-44674</guid>
		<description>There is a bug on that script.
we can see it on the example. while testing the link with two parameters, the css style disappear.
how can we fix that?</description>
		<content:encoded><![CDATA[<p>There is a bug on that script.<br />
we can see it on the example. while testing the link with two parameters, the css style disappear.<br />
how can we fix that?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Johan Hultin</title>
		<link>http://www.phpaddiction.com/tags/php/url-routing-with-php-part-two/comment-page-1/#comment-42747</link>
		<dc:creator>Johan Hultin</dc:creator>
		<pubDate>Sun, 28 Jun 2009 19:17:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpaddiction.com/tags/php/url-routing-with-php-part-two/#comment-42747</guid>
		<description>I don&#039;t really like the whole thing with cases there, I&#039;d say it&#039;s quite static and should be worked on to be more dynamic, I will work on it and see if I find any neat solution</description>
		<content:encoded><![CDATA[<p>I don't really like the whole thing with cases there, I'd say it's quite static and should be worked on to be more dynamic, I will work on it and see if I find any neat solution</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Carlo</title>
		<link>http://www.phpaddiction.com/tags/php/url-routing-with-php-part-two/comment-page-1/#comment-42472</link>
		<dc:creator>Carlo</dc:creator>
		<pubDate>Thu, 25 Jun 2009 11:59:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpaddiction.com/tags/php/url-routing-with-php-part-two/#comment-42472</guid>
		<description>Please can you Tom from the previous comment or someone else explain to me the point?

What does that mean &quot;you can exploit&quot;. Also the introducing sentence is not quite clear for me, I am not english.

But I see in the code some interesting point, so I&#039;d like to understand the whole thing

Thank You
Carlo</description>
		<content:encoded><![CDATA[<p>Please can you Tom from the previous comment or someone else explain to me the point?</p>
<p>What does that mean "you can exploit". Also the introducing sentence is not quite clear for me, I am not english.</p>
<p>But I see in the code some interesting point, so I'd like to understand the whole thing</p>
<p>Thank You<br />
Carlo</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tom</title>
		<link>http://www.phpaddiction.com/tags/php/url-routing-with-php-part-two/comment-page-1/#comment-39572</link>
		<dc:creator>Tom</dc:creator>
		<pubDate>Mon, 18 May 2009 21:26:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpaddiction.com/tags/php/url-routing-with-php-part-two/#comment-39572</guid>
		<description>I dont understand why is a url router?

Here an example of an url router:

	$listRoutes = array(	
				&quot;home&quot; =&gt; &quot;&quot;,
				&quot;articleHome&quot; =&gt; &quot;articles&quot;,
				&quot;news&quot; =&gt; &quot;articles/news&quot;,
				&quot;category&quot; =&gt; &quot;articles/&quot;,
				&quot;article&quot; =&gt; &quot;articles//article-.html&quot;
				);
	
	foreach ($listRoutes AS $name =&gt; $route)
	{
		if (strpos($route,&#039;&lt;&#039;) === false)
		{
			echo &quot;Static $name: &quot;.(match_static_route($url,$route) ? &#039;Yes&#039; : &#039;No&#039;);
		}
		else
		{
			echo &quot;Dynamic $name: &quot;.(count($r = match_dynamic_route2($url,$route)) != 0 ? &#039;Yes&#039;:&#039;No&#039;).&quot;  --  &quot;;
			print_r($r);			
		}
	}

	function match_static_route($url,$route)
	{
		return $url == $route;
	}
	
	function match_dynamic_route2($url,$route)
	{
		$result = array();
	
		$route = str_replace(&quot;/&quot;,&quot;\/&quot;,$route);
		$route = str_replace(&quot;&lt;&quot;,&quot;(?P&quot;,&quot;&gt;[^\/]*)&quot;,$route);

		if (preg_match(&quot;/$route$/&quot;,$url,$matches) &gt; 0)
		{
			foreach ($matches AS $key=&gt;$value)
			{
				if (!is_numeric($key))
				{
					$result[$key] = $value;
				}
			}
		}
		
		return $result;
	}

You can exploit the parameters on $r.</description>
		<content:encoded><![CDATA[<p>I dont understand why is a url router?</p>
<p>Here an example of an url router:</p>
<p>	$listRoutes = array(<br />
				"home" =&gt; "",<br />
				"articleHome" =&gt; "articles",<br />
				"news" =&gt; "articles/news",<br />
				"category" =&gt; "articles/",<br />
				"article" =&gt; "articles//article-.html"<br />
				);</p>
<p>	foreach ($listRoutes AS $name =&gt; $route)<br />
	{<br />
		if (strpos($route,'&lt;') === false)<br />
		{<br />
			echo "Static $name: ".(match_static_route($url,$route) ? 'Yes' : 'No');<br />
		}<br />
		else<br />
		{<br />
			echo "Dynamic $name: ".(count($r = match_dynamic_route2($url,$route)) != 0 ? 'Yes':'No')."  &#8212;  ";<br />
			print_r($r);<br />
		}<br />
	}</p>
<p>	function match_static_route($url,$route)<br />
	{<br />
		return $url == $route;<br />
	}</p>
<p>	function match_dynamic_route2($url,$route)<br />
	{<br />
		$result = array();</p>
<p>		$route = str_replace("/","\/",$route);<br />
		$route = str_replace("&lt;","(?P","&gt;[^\/]*)",$route);</p>
<p>		if (preg_match("/$route$/",$url,$matches) &gt; 0)<br />
		{<br />
			foreach ($matches AS $key=&gt;$value)<br />
			{<br />
				if (!is_numeric($key))<br />
				{<br />
					$result[$key] = $value;<br />
				}<br />
			}<br />
		}</p>
<p>		return $result;<br />
	}</p>
<p>You can exploit the parameters on $r.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Doug Hill</title>
		<link>http://www.phpaddiction.com/tags/php/url-routing-with-php-part-two/comment-page-1/#comment-72</link>
		<dc:creator>Doug Hill</dc:creator>
		<pubDate>Mon, 09 Apr 2007 04:49:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpaddiction.com/tags/php/url-routing-with-php-part-two/#comment-72</guid>
		<description>Roman: I decided against using PATH_INFO since it wouldn&#039;t allow for separators other than forward slashes &quot;/&quot;. I wanted the entire URL after the script not just the directories. Also I found that support for PATH_INFO wasn&#039;t the same across PHP versions.</description>
		<content:encoded><![CDATA[<p>Roman: I decided against using PATH_INFO since it wouldn't allow for separators other than forward slashes "/". I wanted the entire URL after the script not just the directories. Also I found that support for PATH_INFO wasn't the same across PHP versions.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Roman</title>
		<link>http://www.phpaddiction.com/tags/php/url-routing-with-php-part-two/comment-page-1/#comment-66</link>
		<dc:creator>Roman</dc:creator>
		<pubDate>Sun, 08 Apr 2007 05:55:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpaddiction.com/tags/php/url-routing-with-php-part-two/#comment-66</guid>
		<description>I use $_SERVER[&#039;PATH_INFO&#039;]. This way I only get what is past the script path.</description>
		<content:encoded><![CDATA[<p>I use $_SERVER['PATH_INFO']. This way I only get what is past the script path.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
