Stuck If Statment Gets Canceld |
On my content_top page I need to set two if statements for my $route variable.
But when I have second one it stops cancels the first if statment for some reason. How can I get them to work both together. Works fine when just have first one the second $route page id gives correct path but cancels out first one. PHP Code: http://localhost/project/catalog/pages/category/?&path=138_140 Controller PHP Code: <?php
There's only one rule - please don't tell anyone to go and read the manual. Sometimes the manual just SUCKS!
$path = $this->input->get('path');
$page_id = $this->input->get('page_id'); Those will never return boolean "TRUE" like you are testing for. They will either be the values from the GET variable if they exist, or boolean FALSE if they don't (CI2), or NULL in CI3 if it doesn't exist. So you'd probably want your logic to be more like: PHP Code: if ($path === FALSE) { And incorporate the same logic for your $page_id check. Not sure why you have "?&" for your query string with nothing in between though. Should be ?something=var1&something_else=var2
(04-29-2015, 09:42 AM)CroNiX Wrote: $path = $this->input->get('path'); Thanks for that advice I am still learning query strings. Today I also tried code below and seem to work fine but will try and work out what the best is. PHP Code: $url = current_url();
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 |