CoreThink主题开发(三)使用H-ui开发博客主题之定义整站样式

感谢H-ui、感谢CoreThink!

效果图:

CoreThink主题开发(三)使用H-ui开发博客主题之定义整站样式_第1张图片

支持二级菜单,未做更多级别菜单,估计一般站点也用不到三级菜单

Thinkphp的View模板技术很赞,开发了一阵子Thinkphp后又去做java的spring、springMVC、hibernate、发现显示还得拿jsp去写或者html,搜了一大通才发现两个Freemarker和Velocity,之后就是大苦逼的XML文件配置,太shit了!说正事。。

我们要定义一个整站的样式,使得其他页面可以继承,统一风格、样式,大体主要包括导航,模块链接,底部版权。

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="h-ui/static/h-ui/skin/default/skin.css" id="skin" />

    <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>
                </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>
<block name="script">
</block>
</body>
</html>
<!--H-ui前端框架提供前端技术支持 h-ui.net @2015-8-4 -->

使用block预留出后面可以加载css、js、放置页面主体内容的地方

测试一下:

Blog/Home/Index/index.html

<extend name="$_home_public_layout"/>

一行就够了。


你可能感兴趣的:(主题开发,corethink,opencmf)