Reputation: 125
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
if(isset($loggedInUser))
{?>
<?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 }?>
<?php
if (!isset($loggedInUser))
{?>
<a class="nav-item nav-link" href="<?=$this->request->webroot?>users/login">Login</a>
<?php }?>
Upvotes: 0
Views: 45
Reputation: 4469
<?= $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>
Logout
</a>
Upvotes: 1