如果php条件满足,将类放在html中

I am using html navigation panel, below is one of example of open tab.

<li class="nav-item active open">

Now, i want 'active open' to be applied when my url contains \testing\one.

I could get that url by using php code below, i am using codeigniter.

<?php echo $this->uri->uri_string();?>

I can compare it with if statement, but my main question is how can i put this php if condition in

<li></li>

Thanks,

You can do this way -

<li <?php echo ($this->uri->uri_string() === 'value') ? 'class="nav-item active open"' : '' ?>>
<li class="nav-item <?php if($this->uri->uri_string() === 'Value') { echo 'active open' } ?>" ></li>