gpt4 book ai didi

php - Yii:登录时更改标题中用户名的样式

转载 作者:行者123 更新时间:2023-11-28 06:52:19 25 4
gpt4 key购买 nike

我是一个yiibie。我想在登录时更改标题中用户名的样式。目前它以黑色显示,我希望它是斜体白色。下面是我的标题代码,请帮助我,谢谢。

<div class="header">
<div class="row logo">
<div class="col-md-6">
<br>
<a href='<?php echo Yii::app()->request->baseUrl;?>/emergency_response'><p>ERS.com</p></a>
</div>
<div class="col-md-6">
<br>
<a href=''><p class='pull-right'>SignUp</p></a>
<!--to show the username and logout button in the header upon login-->
<?php
if (Yii::app()->user->isGuest) {
echo "<a href='".Yii::app()->request->baseUrl."/user/login'>
<p class='pull-right' style='margin-right: 12px'>LogIn</p>
</a>";
}
if (!Yii::app()->user->isGuest) {
echo Yii::app()->user->name . " <a href='".Yii::app()->request->baseUrl . "/user/logout' style='color:blue';>
<p class='pull-right' style='margin-right: 12px'>Logout</p>
</a>";
}
?>
</div>
</div><!--row ending here-->
<div class="row navigation">
<br>
<div class="col-md-6 col-md-offset-3">
<ul class="nav nav-pills">
<li role="presentation"><a href="#"><p>Home</p></a></li>
<li role="presentation"><a href="#"><p>Ngo's</p></a></li>
<li role="presentation"><a href="#"><p>Blogs</p></a></li>
<li role="presentation"><a href="#"><p>Stories</p></a></li>
<li role="presentation"><a href="#"><p>Videos</p></a></li>
<li role="presentation"><a href="#"><p>Gallery</p></a></li>
</ul>
<br>
</div>
</div><!--row ending here-->
</div> <!--header ending here-->
<!-- <div class="row">
<?php $this->widget('zii.widgets.CMenu',array(
'items'=>array(
array('label'=>'Home', 'url'=>array('/site/index')),
array('label'=>'About', 'url'=>array('/site/page', 'view'=>'about')),
array('label'=>'Contact', 'url'=>array('/site/contact')),
array('label'=>'Login', 'url'=>array('/site/login'), 'visible'=>Yii::app()->user->isGuest),
array('label'=>'Logout ('.Yii::app()->user->name.')', 'url'=>array('/site/logout'), 'visible'=>!Yii::app()->user->isGuest)
),
)); ?>
</div>-->

最佳答案

试试这个

    if (!Yii::app()->user->isGuest) {
echo '<span style="color: white; font-style: italic;">'. Yii::app()->user->name . "</span> <a href='" .
Yii::app()->request->baseUrl .
"/site/logout' ><p class='pull-right' style='margin-right: 12px'>Logout</p></a>";
}

关于php - Yii:登录时更改标题中用户名的样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33700507/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com