Cannot use isset to check for segment.. Why not? |
Cannot do this:
if (isset($this->uri->segment(1))) // Can't use method return value in write context in.... But this is OK: if ($this->uri->segment(1)) Anyone know the reason? I don't know what the "write context" error means. Here is some similar code in system library (although it has no parameter, maybe that's the difference): if ( ! isset($this->lib_name))
To simplify the meaning of the error, it is saying that $this->uri->segment(1) is not a variable, or something that can be checked with isset. segment() is a method in the URI class, and has it's own way of passing back a value to show if it is set. What you can do is this:
PHP Code: if( $seg1 = $this->uri->segment(1) )
(02-17-2016, 05:53 PM)cupboy Wrote: Cannot do this: What you could do is PHP Code: $uri_segment_1 = $this->uri->segment(1);
There's only one rule - please don't tell anyone to go and read the manual. Sometimes the manual just SUCKS!
|
Welcome Guest, Not a member yet? Register Sign In |