Welcome Guest, Not a member yet? Register   Sign In
[Solved] isset not working correct.
#1

(This post was last modified: 06-01-2015, 08:11 AM by wolfgang1983.)

Hello all, I am trying to make a <body class="<?php echo $class;?>"> to help with my specialized css 

For example if isset uri->segment(1) and (2) then would show something like this <body class="page-category-121"> which is correct

But if the uri segments not set I need it to be <body class="common-home"> that would mean it on base url page the home page for some reason when on home page it shows just <body class="-">

When on main url / base url how can I make it show  <body class="common-home">


PHP Code:
$page_id $this->input->get('page_id');
$path $this->input->get('path');
$route $this->uri->segment(1).'/'.$this->uri->segment(2);

if (isset(
$route)) {

if (isset(
$page_id)) {
$class '-' $page_id;
} elseif (isset(
$path)) {
$class '-' $path;
} else {
$class '';
}

$data['class'] = str_replace('/''-'$route).$class;
        
} else {

$data['class'] = 'common-home';


There's only one rule - please don't tell anyone to go and read the manual.  Sometimes the manual just SUCKS!
Reply


Messages In This Thread
[Solved] isset not working correct. - by wolfgang1983 - 04-22-2015, 07:11 AM
RE: isset not working correct. - by kilishan - 04-22-2015, 07:29 AM
RE: isset not working correct. - by wolfgang1983 - 04-22-2015, 08:18 AM
RE: isset not working correct. - by CroNiX - 04-22-2015, 07:29 AM



Theme © iAndrew 2016 - Forum software by © MyBB