<?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: Read The Anchor Part of The URL &#8230; with PHP</title>
	<atom:link href="/2009/04/15/read-the-anchor-part-of-the-url-with-php/feed/" rel="self" type="application/rss+xml" />
	<link>/2009/04/15/read-the-anchor-part-of-the-url-with-php/</link>
	<description>on web development</description>
	<lastBuildDate>Fri, 26 Oct 2018 21:40:18 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.0.3</generator>
	<item>
		<title>By: www.trendweb.nl</title>
		<link>/2009/04/15/read-the-anchor-part-of-the-url-with-php/comment-page-1/#comment-444674</link>
		<dc:creator><![CDATA[www.trendweb.nl]]></dc:creator>
		<pubDate>Tue, 07 Mar 2017 02:51:29 +0000</pubDate>
		<guid isPermaLink="false">/?p=533#comment-444674</guid>
		<description><![CDATA[I think it can be improved. The way it is set up, in some cases, will return the full url or won&#039;t load at once. So why not set it up like this to prevent a little trouble in paradise?

    
    query=location.hash;
    document.cookie= &#039;anchor=&#039;+query;
    

and in php you can get the value you need by exploding that puppy:

$split = explode(&#039;/&#039;, $_COOKIE[&#039;anchor&#039;]);
print_r($split); //use print_r to test it in your screen
print_r($split[1]); //get a value out of the array

print_r is just for testing purposes of course.]]></description>
		<content:encoded><![CDATA[<p>I think it can be improved. The way it is set up, in some cases, will return the full url or won&#8217;t load at once. So why not set it up like this to prevent a little trouble in paradise?</p>
<p>    query=location.hash;<br />
    document.cookie= &#8216;anchor=&#8217;+query;</p>
<p>and in php you can get the value you need by exploding that puppy:</p>
<p>$split = explode(&#8216;/&#8217;, $_COOKIE[&#8216;anchor&#8217;]);<br />
print_r($split); //use print_r to test it in your screen<br />
print_r($split[1]); //get a value out of the array</p>
<p>print_r is just for testing purposes of course.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Trendweb</title>
		<link>/2009/04/15/read-the-anchor-part-of-the-url-with-php/comment-page-1/#comment-444617</link>
		<dc:creator><![CDATA[Trendweb]]></dc:creator>
		<pubDate>Mon, 06 Mar 2017 18:35:10 +0000</pubDate>
		<guid isPermaLink="false">/?p=533#comment-444617</guid>
		<description><![CDATA[I feel there is a small typo in the code (love the post though!) underneath you will find the correct code:


query=location.href.split(&#039;#&#039;)
document.cookie= &#039;anchor&#039; + query[1];




No need for a = after anchor. You will magically notice the page won&#039;t have to be reloaded .]]></description>
		<content:encoded><![CDATA[<p>I feel there is a small typo in the code (love the post though!) underneath you will find the correct code:</p>
<p>query=location.href.split(&#8216;#&#8217;)<br />
document.cookie= &#8216;anchor&#8217; + query[1];</p>
<p>No need for a = after anchor. You will magically notice the page won&#8217;t have to be reloaded .</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JoeFray</title>
		<link>/2009/04/15/read-the-anchor-part-of-the-url-with-php/comment-page-1/#comment-428924</link>
		<dc:creator><![CDATA[JoeFray]]></dc:creator>
		<pubDate>Thu, 10 Nov 2016 10:24:14 +0000</pubDate>
		<guid isPermaLink="false">/?p=533#comment-428924</guid>
		<description><![CDATA[Hi Stoimen,

how may I join you. I tried to post my code here to get some help beacause it doesn&#039;t work for me but the message got moderated.]]></description>
		<content:encoded><![CDATA[<p>Hi Stoimen,</p>
<p>how may I join you. I tried to post my code here to get some help beacause it doesn&#8217;t work for me but the message got moderated.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JoeFray</title>
		<link>/2009/04/15/read-the-anchor-part-of-the-url-with-php/comment-page-1/#comment-428648</link>
		<dc:creator><![CDATA[JoeFray]]></dc:creator>
		<pubDate>Tue, 08 Nov 2016 13:18:26 +0000</pubDate>
		<guid isPermaLink="false">/?p=533#comment-428648</guid>
		<description><![CDATA[Hi Stoimen !
I know that is old topic but I need some help to make it working for my own case. I didn&#039;t any contact link on your website.
First of all, I don&#039;t have any javascript knowledge but I could understand if you explain to me.

here are my entire codes :
testh.php :


	var query= window.location.href.split(&#039;#&#039;);
	document.cookie= &#039;now=&#039; + query[1];
if (query[1] != &quot;&quot;) {
    window.location.reload()
}
	


		
			
		
		
			&lt;!--
				--&gt;&lt;a href=&quot;#&quot; rel=&quot;nofollow&quot;&gt;Home&lt;/a&gt;&lt;!--
				--&gt;&lt;a href=&quot;#link1&quot; rel=&quot;nofollow&quot;&gt;W.I.P&lt;/a&gt;&lt;!--
				--&gt;&lt;a href=&quot;#link2&quot; rel=&quot;nofollow&quot;&gt;Gallery&lt;/a&gt;&lt;!--
				--&gt;&lt;a href=&quot;#link3&quot; rel=&quot;nofollow&quot;&gt;About&lt;/a&gt;
			
		

		
			
		

/*************** end testh.php *******************/
body.php :


	
		
		
		Test
	
	
	
		

			Titre h2
			
				Titre h3
				
					Lorem ipsum dolor sit amet, consectetur adipiscing elit.
					
			
			
				Titre h3
				
					Lorem ipsum dolor sit amet, consectetur adipiscing elit. 
					
			
			
				Titre h3
				
					Lorem ipsum dolor sit amet, consectetur adipiscing elit.
					
			
		
	



Thanks for your help]]></description>
		<content:encoded><![CDATA[<p>Hi Stoimen !<br />
I know that is old topic but I need some help to make it working for my own case. I didn&#8217;t any contact link on your website.<br />
First of all, I don&#8217;t have any javascript knowledge but I could understand if you explain to me.</p>
<p>here are my entire codes :<br />
testh.php :</p>
<p>	var query= window.location.href.split(&#8216;#&#8217;);<br />
	document.cookie= &#8216;now=&#8217; + query[1];<br />
if (query[1] != &#8220;&#8221;) {<br />
    window.location.reload()<br />
}</p>
<p>			<!--
				--><a href="#" rel="nofollow">Home</a><!--
				--><a href="#link1" rel="nofollow">W.I.P</a><!--
				--><a href="#link2" rel="nofollow">Gallery</a><!--
				--><a href="#link3" rel="nofollow">About</a></p>
<p>/*************** end testh.php *******************/<br />
body.php :</p>
<p>		Test</p>
<p>			Titre h2</p>
<p>				Titre h3</p>
<p>					Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
<p>				Titre h3</p>
<p>					Lorem ipsum dolor sit amet, consectetur adipiscing elit. </p>
<p>				Titre h3</p>
<p>					Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
<p>Thanks for your help</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: www.estetiq.opole.pl</title>
		<link>/2009/04/15/read-the-anchor-part-of-the-url-with-php/comment-page-1/#comment-401191</link>
		<dc:creator><![CDATA[www.estetiq.opole.pl]]></dc:creator>
		<pubDate>Sun, 20 Mar 2016 03:16:34 +0000</pubDate>
		<guid isPermaLink="false">/?p=533#comment-401191</guid>
		<description><![CDATA[I am actually glad to glance at this web site posts 
which includes lots of useful facts, thanks for providing such statistics.]]></description>
		<content:encoded><![CDATA[<p>I am actually glad to glance at this web site posts<br />
which includes lots of useful facts, thanks for providing such statistics.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Umar</title>
		<link>/2009/04/15/read-the-anchor-part-of-the-url-with-php/comment-page-1/#comment-20913</link>
		<dc:creator><![CDATA[Umar]]></dc:creator>
		<pubDate>Tue, 18 Feb 2014 10:45:27 +0000</pubDate>
		<guid isPermaLink="false">/?p=533#comment-20913</guid>
		<description><![CDATA[Just be carefull: in javascript use &quot;document.cookie&quot; instead of &quot;document.cookies&quot; :)]]></description>
		<content:encoded><![CDATA[<p>Just be carefull: in javascript use &#8220;document.cookie&#8221; instead of &#8220;document.cookies&#8221; 🙂</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pilon</title>
		<link>/2009/04/15/read-the-anchor-part-of-the-url-with-php/comment-page-1/#comment-20154</link>
		<dc:creator><![CDATA[Pilon]]></dc:creator>
		<pubDate>Wed, 11 Dec 2013 11:09:55 +0000</pubDate>
		<guid isPermaLink="false">/?p=533#comment-20154</guid>
		<description><![CDATA[Hello,
I need this code but i can´t install... the page do reload forever... when we do http://www.page.com/ the page do reload infinitely... and can´t do nothing...

Anyone can help me?

Thanks]]></description>
		<content:encoded><![CDATA[<p>Hello,<br />
I need this code but i can´t install&#8230; the page do reload forever&#8230; when we do <a href="http://www.page.com/" rel="nofollow">http://www.page.com/</a> the page do reload infinitely&#8230; and can´t do nothing&#8230;</p>
<p>Anyone can help me?</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Besmir</title>
		<link>/2009/04/15/read-the-anchor-part-of-the-url-with-php/comment-page-1/#comment-18696</link>
		<dc:creator><![CDATA[Besmir]]></dc:creator>
		<pubDate>Thu, 23 May 2013 11:30:17 +0000</pubDate>
		<guid isPermaLink="false">/?p=533#comment-18696</guid>
		<description><![CDATA[Well using parse_url component, you can grab the fragremnt part
parse_url($url, PHP_URL_FRAGMENT);]]></description>
		<content:encoded><![CDATA[<p>Well using parse_url component, you can grab the fragremnt part<br />
parse_url($url, PHP_URL_FRAGMENT);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stoimen</title>
		<link>/2009/04/15/read-the-anchor-part-of-the-url-with-php/comment-page-1/#comment-15984</link>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
		<pubDate>Wed, 13 Jun 2012 06:43:21 +0000</pubDate>
		<guid isPermaLink="false">/?p=533#comment-15984</guid>
		<description><![CDATA[@mycuztomlife - I have, but in this case it just doesn&#039;t work. First of all parse_url() is a simple string manipulation function - if you give it a url it simply parses it and it will fill up an array with it&#039;s components. But that is the case when you explicitely give the url from it. However when you work with javascript (something that happen entirely on the client side) you can change the #component part without refreshing the page. After all that changes PHP (cause it is on the server side) doesn&#039;t understand what is in the url (especially the #component part). To do this you should send it to the server and explicitely give to parse_url() the url.

Remember - parse_url doesn&#039;t make requests or something that will take the url from your browser&#039;s bar. It simply parses a string.]]></description>
		<content:encoded><![CDATA[<p>@mycuztomlife &#8211; I have, but in this case it just doesn&#8217;t work. First of all parse_url() is a simple string manipulation function &#8211; if you give it a url it simply parses it and it will fill up an array with it&#8217;s components. But that is the case when you explicitely give the url from it. However when you work with javascript (something that happen entirely on the client side) you can change the #component part without refreshing the page. After all that changes PHP (cause it is on the server side) doesn&#8217;t understand what is in the url (especially the #component part). To do this you should send it to the server and explicitely give to parse_url() the url.</p>
<p>Remember &#8211; parse_url doesn&#8217;t make requests or something that will take the url from your browser&#8217;s bar. It simply parses a string.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mycuztomlife</title>
		<link>/2009/04/15/read-the-anchor-part-of-the-url-with-php/comment-page-1/#comment-15982</link>
		<dc:creator><![CDATA[mycuztomlife]]></dc:creator>
		<pubDate>Wed, 13 Jun 2012 05:31:56 +0000</pubDate>
		<guid isPermaLink="false">/?p=533#comment-15982</guid>
		<description><![CDATA[Haven&#039;t you heard about PHP parse_url()

http://php.net/manual/en/function.parse-url.php]]></description>
		<content:encoded><![CDATA[<p>Haven&#8217;t you heard about PHP parse_url()</p>
<p><a href="http://php.net/manual/en/function.parse-url.php" rel="nofollow">http://php.net/manual/en/function.parse-url.php</a></p>
]]></content:encoded>
	</item>
</channel>
</rss>
