Welcome Guest, Not a member yet? Register   Sign In
Can CI grab URL Hash (#page anchor) like uri_segment grabs segments ???
#3

[eluser]Cro_Crx[/eluser]
You could do it with regex with a single line. For something more readable you can do this

Code:
/* Get the total number of segments */
$num_segments = $this->uri->total_segments();
/* Get the entire last segment*/
$last_segment = $this->uri->segment($num_segments);
/* Get the last hash in the segment. */
$last_hash = strrpos($last_segment, '#');

/* Now we just grab our anchor*/
$anchor = substr($last_segment, $last_hash + 1);

The $last_hash value will be false if there isn't one. Although when checking you'll need to use === instead of just ==


Messages In This Thread
Can CI grab URL Hash (#page anchor) like uri_segment grabs segments ??? - by El Forum - 01-28-2010, 12:21 AM



Theme © iAndrew 2016 - Forum software by © MyBB