i have database table client_info(id,first_name,last_name,email,passowrd).I login in to my site using email and password. on the top right in header section of index/home page ..first_name should display of same user whose email is entered...i:e Welcom:Johen if first_name=john where email=current_email. ..what command should i user echo or CHTML or which model..since index.php have no model its only layout layout/main.php file .using yii framework...
Asked
Active
Viewed 937 times
2 Answers
0
The Yii way to achive this would be to create your own WebUser class which extends from the Yii class CWebUser. When a user is logged in, you should store his username in there. After that, you could simply do
echo Yii::app()->user->username;
and so on. A tutorial on this subject can be found here: http://www.yiiframework.com/wiki/60/

ThomasVdBerge
- 7,483
- 4
- 44
- 62