emlog导航栏使用fontawesome图标 - 死方法

2023-05-10 20:12:51 浏览数 (2)

小编以前就一直想给自己的博客的导航栏增加fontawesome图标:

在后天直接添加!不行!!

看了module.php里面的导航。尽然是循环输出!也不能单独设置!

那么没办法!强行来吧!删除循环输出代码:

代码语言:javascript复制
<?php
            foreach($navi_cache as $value):
 if ($value['pid'] != 0) {
 continue;
 }
 if($value['url'] == ROLE_ADMIN && (ROLE == ROLE_ADMIN || ROLE == ROLE_WRITER)):
 ?>
 <li class="item common"><a href="<?php echo BLOG_URL; ?>admin/">管理站点</a></li>
 <li class="item common"><a href="<?php echo BLOG_URL; ?>admin/?action=logout">退出</a></li>
 <?php 
 continue;
            endif;
            $newtab = $value['newtab'] == 'y' ? 'target="_blank"' : '';
            $value['url'] = $value['isdefault'] == 'y' ? BLOG_URL . $value['url'] : trim($value['url'], '/');
            $current_tab = BLOG_URL . trim(Dispatcher::setPath(), '/') == $value['url'] ? 'current' : 'common';
 ?>
 <?php if (!empty($value['children']) || !empty($value['childnavi'])) :?>
 <li class="dropdown">
 <?php if (!empty($value['children'])):?>
 <a href="<?php echo $value['url']; ?>" <?php echo $newtab;?>><?php echo $value['naviname']; ?> <i class="arrow"></i></a>
 <ul class="dropdown-menu">
 <?php foreach ($value['children'] as $row){
                            echo '<li><a href="'.Url::sort($row['sid']).'">'.$row['sortname'].'</a></li>';
 }?>
</ul>
                <?php endif;?>
                <?php if (!empty($value['childnavi'])) :?>
                <a href="<?php echo $value['url']; ?>" <?php echo $newtab;?>><?php echo $value['naviname']; ?> <i class="arrow"></i></a>
                <ul class="dropdown-menu">
                    <?php foreach ($value['childnavi'] as $row){
                            $newtab = $row['newtab'] == 'y' ? 'target="_blank"' : '';
                            echo '<li><a href="' . $row['url'] . "" $newtab >" . $row['naviname'].'</a></li>';
                    }?>
                </ul>
                <?php endif;?>
            </li>
            <?php else:?>
            <li><a href="<?php echo $value['url']; ?>" <?php echo $newtab;?>><?php echo $value['naviname']; ?></a></li>
            <?php endif;?>
            <?php endforeach; ?> 

啊呀!!导航栏不见了!!!咋办!!!那么我们自己添加:

代码语言:javascript复制
<li><a href="http://yankj.com/"><i class="fa fa-home fa-spin" aria-hidden="true"></i>  首页</a></li>
    <li><a href="http://yankj.com/sort/robot"><i class="fa fa-cogs fa-spin" aria-hidden="true"></i>  晨风机器人</a></li>
  <li><a href="http://yankj.com/sort/Anime"><i class="fa fa-pie-chart fa-spin" aria-hidden="true"></i>  动漫资讯</a></li>
  <li><a href="http://yankj.com/sort/technology"><i class="fa fa-code fa-spin" aria-hidden="true"></i>  技术分享</a></li>
  <li><a href="http://yankj.com/guestbook.html"><i class="fa fa-qq fa-spin" aria-hidden="true"></i>  给我留言</a></li>
 <li><a href="http://yankj.com/links.html"><i class="fa fa-ioxhost fa-spin" aria-hidden="true"></i>  友情链接</a></li>

哈哈哈,以上链接可以自己替换!不过终于OK啦!!

此方法是死方法,增加导航栏的时候需要去代码里面修改!!!。

0 人点赞