Example #1
0
function readTemplateModuleStr($filePath, $defaultContent, $moduleId)
{
    $startStr = '';
    $endStr = '';
    $content = '';
    $startStr = '<!--#Module ' . $moduleId . ' start#-->';
    $endStr = '<!--#Module ' . $moduleId . ' end#-->';
    //FilePath = ReplaceGlobleLable(FilePath)                '替换全部标签        '添加于2014 12 11
    //文件不存在,则追加模板路径 20150616 给VB软件里用
    if (CheckFile($filePath) == false) {
        $filePath = $GLOBALS['webTemplate'] . $filePath;
    }
    $filePath = handleRGV($filePath, '[$模块目录$]', 'Module/');
    //Module
    if ($defaultContent != '') {
        $content = $defaultContent;
    } else {
        if (CheckFile($filePath) == true) {
            $content = getFText($filePath);
        } else {
            $content = $GLOBALS['code'];
            //默认用内容指定内容
        }
    }
    if (inStr($content, $startStr) == false) {
        $startStr = '<!--#Module ' . $moduleId . ' Start#-->';
    }
    if (inStr($content, $endStr) == false) {
        $endStr = '<!--#Module ' . $moduleId . ' End#-->';
    }
    if (inStr($content, $startStr) > 0 && inStr($content, $endStr) > 0) {
        $readTemplateModuleStr = StrCut($content, $startStr, $endStr, 2);
    } else {
        $readTemplateModuleStr = '模块[' . $moduleId . ']不存在,路径=' . $filePath;
        $GLOBALS['PHPDie']($readTemplateModuleStr . $content);
    }
    return @$readTemplateModuleStr;
}
Example #2
0
function replaceGlobleVariable($content)
{
    $content = handleRGV($content, '{$cfg_webSiteUrl$}', $GLOBALS['cfg_webSiteUrl']);
    //网址
    $content = handleRGV($content, '{$cfg_webTemplate$}', $GLOBALS['cfg_webTemplate']);
    //模板
    $content = handleRGV($content, '{$cfg_webImages$}', $GLOBALS['cfg_webImages']);
    //图片路径
    $content = handleRGV($content, '{$cfg_webCss$}', $GLOBALS['cfg_webCss']);
    //css路径
    $content = handleRGV($content, '{$cfg_webJs$}', $GLOBALS['cfg_webJs']);
    //js路径
    $content = handleRGV($content, '{$cfg_webTitle$}', $GLOBALS['cfg_webTitle']);
    //网站标题
    $content = handleRGV($content, '{$cfg_webKeywords$}', $GLOBALS['cfg_webKeywords']);
    //网站关键词
    $content = handleRGV($content, '{$cfg_webDescription$}', $GLOBALS['cfg_webDescription']);
    //网站描述
    $content = handleRGV($content, '{$cfg_webSiteBottom$}', $GLOBALS['cfg_webSiteBottom']);
    //网站底部内容
    $content = handleRGV($content, '{$glb_columnId$}', $GLOBALS['glb_columnId']);
    //栏目Id
    $content = handleRGV($content, '{$glb_columnName$}', $GLOBALS['glb_columnName']);
    //栏目名称
    $content = handleRGV($content, '{$glb_columnType$}', $GLOBALS['glb_columnType']);
    //栏目类型
    $content = handleRGV($content, '{$glb_columnENType$}', $GLOBALS['glb_columnENType']);
    //栏目英文类型
    $content = handleRGV($content, '{$glb_Table$}', $GLOBALS['glb_table']);
    //表
    $content = handleRGV($content, '{$glb_Id$}', $GLOBALS['glb_id']);
    //id
    $content = handleRGV($content, '[$模块目录$]', 'Module/');
    //Module
    //兼容旧版本 渐渐把它去掉
    $content = handleRGV($content, '{$WebImages$}', $GLOBALS['cfg_webImages']);
    //图片路径
    $content = handleRGV($content, '{$WebCss$}', $GLOBALS['cfg_webCss']);
    //css路径
    $content = handleRGV($content, '{$WebJs$}', $GLOBALS['cfg_webJs']);
    //js路径
    $content = handleRGV($content, '{$Web_Title$}', $GLOBALS['cfg_webTitle']);
    $content = handleRGV($content, '{$Web_KeyWords$}', $GLOBALS['cfg_webKeywords']);
    $content = handleRGV($content, '{$Web_Description$}', $GLOBALS['cfg_webDescription']);
    $content = handleRGV($content, '{$EDITORTYPE$}', EDITORTYPE);
    //后缀
    $content = handleRGV($content, '{$WEB_VIEWURL$}', WEB_VIEWURL);
    //首页显示网址
    //文章用到
    $content = handleRGV($content, '{$glb_artitleAuthor$}', $GLOBALS['glb_artitleAuthor']);
    //文章作者
    $content = handleRGV($content, '{$glb_artitleAdddatetime$}', $GLOBALS['glb_artitleAdddatetime']);
    //文章添加时间
    $content = handleRGV($content, '{$glb_upArticle$}', $GLOBALS['glb_upArticle']);
    //上一篇文章
    $content = handleRGV($content, '{$glb_downArticle$}', $GLOBALS['glb_downArticle']);
    //下一篇文章
    $content = handleRGV($content, '{$glb_aritcleRelatedTags$}', $GLOBALS['glb_aritcleRelatedTags']);
    //文章标签组
    $content = handleRGV($content, '{$glb_aritcleBigImage$}', $GLOBALS['glb_aritcleBigImage']);
    //文章大图
    $content = handleRGV($content, '{$glb_aritcleSmallImage$}', $GLOBALS['glb_aritcleSmallImage']);
    //文章小图
    $content = handleRGV($content, '{$glb_searchKeyWord$}', $GLOBALS['glb_searchKeyWord']);
    //首页显示网址
    $replaceGlobleVariable = $content;
    return @$replaceGlobleVariable;
}