Welcome Guest, Not a member yet? Register   Sign In
How to use '#'...
#1

[eluser]evolutionxbox[/eluser]
I have a page, with div elements with unique 'id' attributes.

When I want to link to that specific section I would use a '#' in the anchor 'href' attribute.

How can I get codeigniter to know what value comes after that '#'?

...


Example:
Code:
<a href="#goto">Go to below</a>

...

<div id="goto">You are here!</div>

url = http://example.com/home#goto

I want to get at the bit after the '#' (i.e. the goto bit).
#2

[eluser]taewoo[/eluser]
That's a HASH... and this isn't a CI related question. It's an HTML question.

PS: You need anchor name:
Code:
<a name="goto">Your #goto will scroll browser to here</a>
#3

[eluser]evolutionxbox[/eluser]
The hash also works with id attributes, but my question remains to do with CI.

Like uri_string(), how can I get the hash value from the uri (not a html question)?
#4

[eluser]taewoo[/eluser]
not sure if uri string reports that. You can test but im pretty sure it doesn't...
parse_url is your best bet
#5

[eluser]evolutionxbox[/eluser]
I found that the hash value never gets passed to the server... whilst parse_url is a good idea it won't be able to parse anything.

Ah well.
#6

[eluser]taewoo[/eluser]
u can do it with Javascript... get the hash and pass via ajax or as form variable
#7

[eluser]evolutionxbox[/eluser]
True.




Theme © iAndrew 2016 - Forum software by © MyBB