我需要两个图标,
如果是验证电子邮件,请显示没有hyberlink的图标并设置"激活"绿色风格的CSS课程并检查。
如果未验证电子邮件,则图标将链接到验证页面,默认为灰色样式
以下哪种解决方案更好,更标准?
<a href="<?php echo ($modelStatic->isVerifiedEmail) ? 'javascript:void(0)' :
Yii::app()->createUrl('/user/reActivate'); ?>"
class="item<?php if($modelStatic->isVerifiedEmail) echo ' activated'; ?>">
<div class="confirm-icon">
<i class="fa fa-envelope-o"></i>
</div>
<div class="text">
<?php echo Yii::t('app', 'Verify Email'); ?>
</div>
</a>
<style>
.activated {
cursor: default;
}
</style>
if($modelStatic->isVerifiedEmail) : ?>
<div class="item activated">
<div class="confirm-icon">
<i class="fa fa-envelope-o"></i>
</div>
<div class="text">
<?php echo Yii::t('app', 'Verify Email'); ?>
</div>
</div>
<?php else: ?>
<a href="<?php echo Yii::app()->createUrl('/user/reActivate'); ?>"
class="item">
<div class="confirm-icon">
<i class="fa fa-envelope-o"></i>
</div>
<div class="text">
<?php echo Yii::t('app', 'Verify Email'); ?>
</div>
</a>
<?php endif; ?>
<?php if($modelStatic->isVerifiedEmail) : ?>
<div class="item activated">
<?php else: ?>
<a href="<?php echo Yii::app()->createUrl('/user/reActivate'); ?>" class="item">
<?php endif; ?>
<div class="confirm-icon">
<i class="fa fa-envelope-o"></i>
</div>
<div class="text">
<?php echo Yii::t('app', 'Verify Email'); ?>
</div>
<?php if($modelStatic->isVerifiedEmail) : ?>
</div>
<?php else: ?>
</a>
<?php endif; ?>
答案 0 :(得分:1)