CoreThink主题开发(八)使用H-ui开发博客主题之用户登录之前及登录之后
感谢H-ui、感谢CoreThink!
效果图:
登录之后
登录窗体
想做登录之后的下拉菜单的,实在做不出来了,就一般显示了。。。
整个面包屑导航这里,先遍历模块,并且是允许前台显示的模块,之后就是判断用户是否已经登录,已经登录了,就显示个人中心,否则就显示登录和注册按钮。
代码:
<nav class="breadcrumb"> <div class="container"> <span class="c-gray en"> <i class="Hui-iconfont"></i> <a href="#">您好,欢迎来到 {:C('WEB_SITE_TITLE')} !</a> <!-- 系统模块导航 开始--> <opencmf:nav_list name="vo" pid="0"> <a target="{$vo.target}" href="{$vo.href}"> <span> {$vo.title}</span> </a> </opencmf:nav_list> <!-- 系统模块导航 结束--> </span> <present name="_user_auth"> <a href="#" > <img class="round" src="{$_user_auth.avatar|get_cover='avatar'}" height="30px" width="30px" alt="{$_user_auth.nickname}" /> <span>{$_user_auth.nickname} <span> {$_new_message} </span> <!-- 新消息数量 --> </span> <span class="caret"></span> </a> <a href="{:U('User/Index/home', array('uid' => $_user_auth['uid']), true, true)}"><span class="label label-secondary radius">个人主页</span></a> <volist name="_user_nav_main" id="vo_nav"> <a href="{:U($vo_nav['url'], null, true, true)}" class="{$vo_nav.class}"><span class="label label-secondary radius"> {$vo_nav.title}</span></a> </volist> <a href="{:U('User/User/logout', null, true, true)}" class="ajax-get"><span class="label label-danger radius">注销登录</span></a> <else/> <a class="btn btn-success-outline radius" data-toggle="modal" href="#register-modal">注册</a> <a class="btn btn-danger-outline radius" data-toggle="modal" href="#login-modal">登录</a> </present> </div> </nav>
Blog/Home/Public/layout.html
<!DOCTYPE HTML> <html> <head> <meta charset="utf-8"> <meta name="renderer" content="webkit|ie-comp|ie-stand"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/> <meta http-equiv="Cache-Control" content="no-siteapp"/> <!--[if lt IE 9]> <script type="text/javascript" src="__HOME_LIBS__/html5.js"></script> <script type="text/javascript" src="__HOME_LIBS__/respond.min.js"></script> <script type="text/javascript" src="__HOME_LIBS__/PIE_IE678.js"></script> <![endif]--> <link rel="stylesheet" type="text/css" href="__HOME_CSS__/H-ui.min.css"/> <link rel="stylesheet" type="text/css" href="__HOME_LIBS__/Hui-iconfont/1.0.7/iconfont.css"/> <link rel="stylesheet" type="text/css" href="__HOME_LIBS__/icheck/icheck.css"/> <link rel="stylesheet" type="text/css" href="__HOME_CSS__/style.css"/> <!--[if IE 6]> <script type="text/javascript" src="__HOME_LIBS__/DD_belatedPNG_0.0.8a-min.js"></script> <script>DD_belatedPNG.fix('*');</script> <![endif]--> <block name="title"><title>{:C('WEB_SITE_TITLE')}</title></block> <meta name="keywords" content="关键词,5个左右,单个8汉字以内"> <meta name="description" content="网站描述,字数尽量空制在80个汉字,160个字符以内!"> </head> <body> <div class="clearfix hook hook-page-header"> {:hook('PageHeader')} <!-- 文档开始钩子 --> </div> <!-- 页面导航,支持二级菜单 --> <header class="navbar-wrapper"> <div class="navbar navbar-black navbar-fixed-top"> <div class="container cl"> <a class="logo navbar-logo hidden-xs" href="/aboutHui.shtml">{:C('WEB_SITE_TITLE')}</a> <a class="logo navbar-logo-m visible-xs" href="/aboutHui.shtml">H-ui</a> <span class="logo navbar-slogan hidden-xs">{:C('WEB_SITE_SLOGAN')}</span> <a aria-hidden="false" class="nav-toggle Hui-iconfont visible-xs" href="javascript:;"></a> <nav class="nav navbar-nav nav-collapse" role="navigation" id="Hui-navbar"> <ul class="cl"> <li><a href="{:C('HOME_PAGE')}">首页</a></li> <cms:category_list name="vo" pid="0" group="1"> <php>if($vo['_child']):</php> <li class="dropDown dropDown_hover"> <a href="{$vo.href}" class="dropDown_A" data-toggle="dropdown" role="button"> {$vo.title} <span class="caret"></span> </a> <ul class="dropDown-menu menu radius box-shadow"> <volist name="vo._child" id="vo1"> <li> <a href="{$vo1.href}">{$vo1.title}</a> </li> </volist> </ul> </li> <php>else:</php> <li> <a href="{$vo.href}"> <span> {$vo.title}</span> </a> </li> <php>endif;</php> </cms:category_list> </ul> </nav> <nav class="navbar-userbar hidden-xs"> </nav> </div> </div> </header> <nav class="breadcrumb"> <div class="container"> <span class="c-gray en"> <i class="Hui-iconfont"></i> <a href="#">您好,欢迎来到 {:C('WEB_SITE_TITLE')} !</a> <!-- 系统模块导航 开始--> <opencmf:nav_list name="vo" pid="0"> <a target="{$vo.target}" href="{$vo.href}"> <span> {$vo.title}</span> </a> </opencmf:nav_list> <!-- 系统模块导航 结束--> </span> <present name="_user_auth"> <a href="#" > <img class="round" src="{$_user_auth.avatar|get_cover='avatar'}" height="30px" width="30px" alt="{$_user_auth.nickname}" /> <span>{$_user_auth.nickname} <span> {$_new_message} </span> <!-- 新消息数量 --> </span> <span class="caret"></span> </a> <a href="{:U('User/Index/home', array('uid' => $_user_auth['uid']), true, true)}"><span class="label label-secondary radius">个人主页</span></a> <volist name="_user_nav_main" id="vo_nav"> <a href="{:U($vo_nav['url'], null, true, true)}" class="{$vo_nav.class}"><span class="label label-secondary radius"> {$vo_nav.title}</span></a> </volist> <a href="{:U('User/User/logout', null, true, true)}" class="ajax-get"><span class="label label-danger radius">注销登录</span></a> <else/> <a class="btn btn-success-outline radius" data-toggle="modal" href="#register-modal">注册</a> <a class="btn btn-danger-outline radius" data-toggle="modal" href="#login-modal">登录</a> </present> </div> </nav> <block name="main"> </block> <!--页脚--> <footer class="footer mt-20"> <div class="container"> <p>{:C('WEB_SITE_COPYRIGHT')} <br> <a rel="nofollow" target="_blank" href="http://www.miitbeian.gov.cn/"> {:C('WEB_SITE_ICP')} </a> </p> </div> </footer> <script type="text/javascript" src="__HOME_LIBS__/jquery/1.9.1/jquery.min.js"></script> <script type="text/javascript" src="__HOME_LIBS__/layer/2.1/layer.js"></script> <script type="text/javascript" src="__HOME_LIBS__/laypage/1.2/laypage.js"></script> <script type="text/javascript" src="__HOME_LIBS__/My97DatePicker/WdatePicker.js"></script> <script type="text/javascript" src="__HOME_LIBS__/icheck/jquery.icheck.min.js"></script> <script type="text/javascript" src="__HOME_LIBS__/bootstrap-Switch/bootstrapSwitch.js"></script> <script type="text/javascript" src="__HOME_LIBS__/Validform/5.3.2/Validform.min.js"></script> <script type="text/javascript" src="__HOME_LIBS__/Validform/5.3.2/passwordStrength-min.js"></script> <script type="text/javascript" src="__HOME_JS__/H-ui.js"></script> <script> var navigation = responsiveNav("Hui-navbar", {customToggle: ".nav-toggle"}); $(function () { $('.skin-minimal input').iCheck({ checkboxClass: 'icheckbox-blue', radioClass: 'iradio-blue', increaseArea: '20%' }); $("#demoform").Validform({ tiptype: 2 }); }); </script> </block> <div class="clearfix hook hook-page-footer"> {:hook('PageFooter')} <!-- 文档末尾钩子 --> </div> <include file="$_user_login_modal"/> <!-- 登录弹窗 --> <script type="text/javascript" src="__HOME_LIBS__/bootstrap-modal/2.2.4/bootstrap-modalmanager.js"></script> <script type="text/javascript" src="__HOME_LIBS__/bootstrap-modal/2.2.4/bootstrap-modal.js"></script> <block name="script"> </block> </body> </html> <!--H-ui前端框架提供前端技术支持 h-ui.net @2015-8-4 -->