Difference between #3 and #4 of
How to create a simple logout link in the view?

Revision #4 has been created by mi.sarah on Mar 17, 2014, 10:58:47 AM with the memo:

deleted what doesnt work section
« previous (#3) next (#5) »

Changes

Title unchanged

How to create a simple logout link in the view?

Category unchanged

How-tos

Yii version unchanged

Tags unchanged

Logout, Link, user, URL, views

Content changed

[...]
}
```



### Show Logout only to logged-in users  
------------------
Just wrap an if arround your code and ask if the user is not a guest:
[...]
```

### What Does Not Work
 
 

 
 
```php 
<a href="<?php echo Yii::app()->request->baseUrl; ?>/site/logout">Logout</a>
 
```
 
 
-  
```php 
<a href="Yii::app()->user->logout();echo Yii::app()->homeUrl; ">Logout</a>
 
```
 
0 2
1 follower
Viewed: 47 402 times
Version: 1.1
Category: How-tos
Written by: mi.sarah
Last updated by: CeBe
Created on: Feb 28, 2014
Last updated: 10 years ago
Update Article

Revisions

View all history