Solution 1 :

<?= $this->Html->link('<span class = "nav-item nav-link active"></span> Logout,
                       ['controller' => 'Users', 'action' => 'logout'],
                       ['escape' => false]);

OR you can use URL build


<a href="<?= $this->Url->build(['controller'=>'Users', 'action'=>'logout','_full'=>true]); ?>">
   <span class = "nav-item nav-link active"></span>

Problem :

I am doing a small project using cakephp and I am fairly new at it. I am doing a navbar with login/logout depending the state of the user. The problem, which is minor, is that I want to make the logout look like an tag. At this moment, it just looks like a link because, well, it’s a link.. This is the code that I have so far:

         <?php echo "<a class='nav-item nav-link active'>".$this->Html->link('Logout',['controller' => 'Users', 'action' => 'logout']);?></a> <!--I want to make this look like an <a> tag-->
    <?php }?>

    if (!isset($loggedInUser))
         <a class="nav-item nav-link" href="<?=$this->request->webroot?>users/login">Login</a> 
    <?php }?>


Comment posted by Rick Astley

Thanks for the reply.. neither of them worked however