zoukankan      html  css  js  c++  java
  • EmWebAdmin 生成流程分析

    • 继上一篇的简略的说明 EmWebAdmin 的地址以后下载,生成之后,这一篇讲一下该模板的生成流程

        // 上一篇地址:
        http://www.cnblogs.com/chenfulin5/p/6856379.html
    
    • EmWebAdmin Makefile

          1 all:
          2     @chmod +x templates/bin/emWebAdmin
          3     @templates/bin/emWebAdmin generate
          4 
          5 clean:
          6     @chmod +x templates/bin/emWebAdmin
          7     @templates/bin/emWebAdmin clean
    
    • EmWebAdmin templates/bin/emWebAdmin

        // 如果在顶层目录执行 make all
        // 则执行  templates/bin/emWebAdmin generate
    
         10 contents=`ls custom/contents`
         11  # 参数为生成
         12 if [ $1 == 'generate' ]; then
         13 
         14     # make output directory
         15     if [ ! -d "output" ]; then
         16         mkdir output   创建相应的目录
         17         chmod 777 output 
         18         mkdir output/tpl
         19     fi
         21     # generate all php file
         22     for content in $contents
         # 以templates/gentelella/base.tpl 里面的内容为模板
         # 替换里面的 ***** 内容为 custom/contents 文件夹内文件的名字
         # 并重定向到 output 内,名字改为custonm/contents 文件夹内文件的名字,后缀改为 .php ,原为 .tpl
         23     do  
         24         sed "s/********/$content/g" templates/gentelella/base.tpl > output/`basename $content .tpl`.php
         25         echo "generate `basename $content .tpl`.php over."
         26         
         27     done
         28     
                # 将 custom/common/ 里面的内容复制到 output 内
                # 这里面主要包括 json配置文件目录,PHP接写json配置文件,并保存在Smarty变量中
                # 自定义的 css 样式以及js 样式,登录界面以及登录处理
         29     # copy custom/common .php file to output directory.
         30     if [ -d "custom/common" ]; then
         31         cp custom/common/* output/ -rf
         32     fi
         33     
                # 将 custom/contents 里面的模板文件拷贝到 output/tpl 用于最后生成相对应文件
         34     # copy contents .php file to output/tpl directory.
         35     if [ -d "custom/contents" ]; then
         36         cp custom/contents/* output/tpl/ -rf
         37     fi
         38     
                # 将依赖库复制过去
         39     # copy all dependents file(js, css, smarty lib) to output directory.
         40     if [ -d "templates/dependents" ]; then
         41         cp templates/dependents/* output/ -rf
         42     fi
         43 
                # 将另外一些模板文件复制过去
         44     # copy theme templates to output/tpl directory.
         45     if [ -d "templates/gentelella" ]; then
         46         cp templates/gentelella/* output/tpl/ -rf
         47     fi
         48 
                #  这里面会复制一个很重要的 json 文件,在 templates/smarty/config 内
                #  这个文件配置了想对应的调用文件以及你侧边栏会有相对应的菜单
         49     # copy smarty template config, preprocess file to output/tpl directory.
         50     if [ -d "templates/smarty" ]; then
         51         cp templates/smarty/preprocess/* output/tpl/ -rf
         52         cp templates/smarty/config output/ -rf
         53     fi
         54 
         55     exit 0
         56 fi
    
  • 相关阅读:
    csuoj 1111: 三家人
    csu oj 1339: 最后一滴血
    csuoj 1337: 搞笑版费马大定理
    csuoj 1334: 好老师
    csu oj 1330 字符识别?
    C++动态内存分配
    变量内存分配
    codevs 2235 机票打折
    contesthunter CH Round #64
    面试分享:一年经验初探阿里巴巴前端社招
  • 原文地址:https://www.cnblogs.com/chenfulin5/p/6856752.html
Copyright © 2011-2022 走看看