如何添加当前菜单fontawesome <i> </i>

时间:2015-03-05 22:00:34

标签: php html

我正在尝试使用PHP中的图标来指示活动菜单。

这是我的html版本:

<ul class="languages">
    <li class="active">
        <a href="page_home1.html#">English <i class="fa fa-check"></i></a> 
    </li>
    <li><a href="page_home1.html#">Spanish</a></li>
</ul>

这是我的PHP版本

<li class="languagesSelector">
    <i class="fa fa-globe"></i>
    <a><?php echo __("Languages") ?></a>
    <ul class="languages">
        <?php
        $currentLanguage = $user->language; // remember language
        foreach($languages as $language) {
            if(!$page->viewable($language)) continue; // is page viewable in this language?
            $user->language = $language;
            if($language->id == $currentLanguage->id) {
                echo "<li class='active'>" <i class='fa fa-check'></i> ;
            } else {
                echo "<li>";
            }
            echo "<a href='$page->url'>$language->title</a></li>";
        }
        $user->language = $currentLanguage; // restore language
        ?>
    </ul>
</li>

如何仅使用PHP中的函数来实现此目的?

0 个答案:

没有答案