Page 1 of 1

parameter and anchor tag

Posted: Wed Jan 21, 2009 12:37 am
by nay369
the url is like this: http://www.domain.com/page/pagename:#1 book

actually, pagename is a parameter and "#1 book" doesn't go into the $pagename. Is there a way?

Re: parameter and anchor tag

Posted: Wed Jan 21, 2009 12:49 am
by requinix
No, there isn't. Not directly.

It can be done with JavaScript but that's not something you should consider trying.

Re: parameter and anchor tag

Posted: Wed Jan 21, 2009 1:02 am
by nay369
hmm!
so there's no way?

yes, i found that it can be done with JS and i dont wanna use JS to read that param.

change the value before posting to url?

Re: parameter and anchor tag

Posted: Wed Jan 21, 2009 1:31 am
by requinix
nay369 wrote:hmm!
so there's no way?
When the browser asks your server for the page it doesn't tell it what the anchor/hash is. The browser literally asks for "/page/pagename:". When it gets the page back it looks for the "1 book" anchor and (if found) scrolls to it.

Since PHP works on the server, and the server doesn't know about the anchor, PHP won't know about it either.