当前位置: 首页>>代码示例>>PHP>>正文


PHP get_template_info函数代码示例

本文整理汇总了PHP中get_template_info函数的典型用法代码示例。如果您正苦于以下问题:PHP get_template_info函数的具体用法?PHP get_template_info怎么用?PHP get_template_info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_template_info函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: syn_templates

function syn_templates()
{
    global $db, $tpf;
    $dirs = scandir(PHPDISK_ROOT . 'templates');
    sort($dirs);
    for ($i = 0; $i < count($dirs); $i++) {
        if (check_template($dirs[$i])) {
            $arr[] = $dirs[$i];
        }
    }
    $q = $db->query("select * from {$tpf}templates where actived=1");
    while ($rs = $db->fetch_array($q)) {
        if (check_template($rs['tpl_name'])) {
            $active_templates .= $rs['tpl_name'] . ',';
        }
    }
    $db->free($q);
    unset($rs);
    if (trim(substr($active_templates, 0, -1))) {
        $active_arr = explode(',', $active_templates);
    }
    for ($i = 0; $i < count($arr); $i++) {
        $tmp = get_template_info($arr[$i]);
        if (@in_array($arr[$i], $active_arr)) {
            $sql_do .= "('" . $db->escape($arr[$i]) . "','1','" . $db->escape(trim($tmp['tpl_type'])) . "'),";
        } else {
            $sql_do .= "('" . $db->escape($arr[$i]) . "','0','" . $db->escape(trim($tmp['tpl_type'])) . "'),";
        }
    }
    $sql_do = substr($sql_do, 0, -1);
    $db->query_unbuffered("truncate table {$tpf}templates;");
    $db->query_unbuffered("replace into {$tpf}templates(tpl_name,actived,tpl_type) values {$sql_do} ;");
    $num = @$db->result_first("select count(*) from {$tpf}templates where tpl_type='admin' and actived=1");
    if (!$num) {
        $db->query_unbuffered("update {$tpf}templates set actived=1 where tpl_name='admin'");
    }
    $num = @$db->result_first("select count(*) from {$tpf}templates where tpl_type='user' and actived=1");
    if (!$num) {
        $db->query_unbuffered("update {$tpf}templates set actived=1 where tpl_name='default'");
    }
    return true;
}
开发者ID:saintho,项目名称:phpdisk,代码行数:42,代码来源:templates.inc.php

示例2: init_lang_tpl

 public static function init_lang_tpl()
 {
     global $C, $settings, $auth;
     $dir = PHPDISK_ROOT . 'system/global/';
     make_dir($dir);
     $file = $dir . 'lang_settings.inc.php';
     file_exists($file) ? require_once $file : lang_cache();
     $file = $dir . 'tpl_settings.inc.php';
     file_exists($file) ? require_once $file : tpl_cache();
     if (count($tpl_settings)) {
         foreach ($tpl_settings as $v) {
             if ($v[actived] && $v[tpl_type] == 'user') {
                 $user_tpl_dir = $v[tpl_name];
             }
             if ($v[actived] && $v[tpl_type] == 'admin') {
                 $admin_tpl_dir = $v[tpl_name];
             }
         }
     }
     if (count($lang_settings)) {
         foreach ($lang_settings as $v) {
             if ($v[actived]) {
                 $lang_name = $v[lang_name];
             }
         }
     }
     if ($settings[open_switch_tpls]) {
         $ptpl = gpc('ptpl', 'C', '');
         $user_tpl_dir = $C[tpl_name] = $ptpl ? check_template($ptpl) ? $ptpl : $user_tpl_dir : $user_tpl_dir;
         //$C[tpl_name] = $user_tpl_dir;
     }
     $arr = get_template_info($user_tpl_dir);
     $is_fms = $arr['template_core'] == 'fms' && $auth[open_fms] ? 1 : 0;
     $user_tpl_dir = $user_tpl_dir ? "templates/{$user_tpl_dir}/" : 'templates/default/';
     $admin_tpl_dir = $admin_tpl_dir ? "templates/{$admin_tpl_dir}/" : 'templates/admin/';
     $lang_name = $lang_name ? $lang_name : 'zh_cn';
     return array('user_tpl_dir' => $user_tpl_dir, 'admin_tpl_dir' => $admin_tpl_dir, 'lang_name' => $lang_name, 'fms' => $is_fms);
 }
开发者ID:saintho,项目名称:phpdisk,代码行数:38,代码来源:core.class.php

示例3: foreach

    foreach ($_FILES AS $code => $file)
    {
        /* 判断用户是否选择了文件 */
        if ((isset($file['error']) && $file['error'] == 0) || (!isset($file['error']) && $file['tmp_name'] != 'none'))
        {
            /* 检查上传的文件类型是否合法 */
            if (!check_file_type($file['tmp_name'], $file['name'], $allow_file_types))
            {
                sys_msg(sprintf($_LANG['msg_invalid_file'], $file['name']));
            }
            else
            {
                if ($code == 'shop_logo')
                {
                    include_once('includes/lib_template.php');
                    $info = get_template_info($_CFG['template']);

                    $file_name = str_replace('{$template}', $_CFG['template'], $file_var_list[$code]['store_dir']) . $info['logo'];
                }
                elseif ($code == 'watermark')
                {
                    $ext = array_pop(explode('.', $file['name']));
                    $file_name = $file_var_list[$code]['store_dir'] . 'watermark.' . $ext;
                    if (file_exists($file_var_list[$code]['value']))
                    {
                        @unlink($file_var_list[$code]['value']);
                    }
                }
                elseif($code == 'wap_logo')
                {
                    $ext = array_pop(explode('.', $file['name']));
开发者ID:apgmer,项目名称:WShop,代码行数:31,代码来源:shop_config.php

示例4: read_style_and_tpl

/**
 * 读取当前风格信息与当前模板风格列表
 *
 * @access  public
 * @param   string  $tpl_name       模版名称
 * @param   string  $tpl_style 模版风格名
 * @return
 */
function read_style_and_tpl($tpl_name, $tpl_style)
{
    $style_info = array();
    $style_info = get_template_info($tpl_name, $tpl_style);
    $tpl_style_info = array();
    $tpl_style_info = read_tpl_style($tpl_name, 2);
    $tpl_style_list = '';
    if (count($tpl_style_info) > 1) {
        foreach ($tpl_style_info as $value) {
            $tpl_style_list .= '<span style="cursor:pointer;" onMouseOver="javascript:onSOver(\'screenshot\', \'' . $value . '\', this);" onMouseOut="onSOut(\'screenshot\', this, \'' . $style_info['screenshot'] . '\');" onclick="javascript:setupTemplateFG(\'' . $tpl_name . '\', \'' . $value . '\', \'\');" id="templateType_' . $value . '"><img src="../themes/' . $tpl_name . '/images/type' . $value . '_';
            if ($value == $tpl_style) {
                $tpl_style_list .= '1';
            } else {
                $tpl_style_list .= '0';
            }
            $tpl_style_list .= '.gif" border="0"></span>&nbsp;';
        }
    }
    $style_info['tpl_style'] = $tpl_style_list;
    return $style_info;
}
开发者ID:norain2050,项目名称:mhFault,代码行数:29,代码来源:template.php

示例5: get_template_info

<?php

/**
 * $Author: pengwenfei p@simple-log.com
 * $Date: 2011-02-01
 * www.simple-log.com 
*/
//此文件很大的程度上是参考于ecshop,ecshop的设计模式和设计方法,只是我考虑将数据保存在文件中以提高速度
if ($action == 'templates_list') {
    $current_template_info = get_template_info($config['template_name']);
    /* 获得可用的模版 */
    $available_templates = array();
    $template_dir = @opendir(PBBLOG_ROOT . '/themes/');
    while ($file = readdir($template_dir)) {
        if ($file != '.' && $file != '..' && is_dir(PBBLOG_ROOT . 'themes/' . $file)) {
            $available_templates[] = get_template_info($file);
        }
    }
    @closedir($template_dir);
    $smarty->assign('curr_template', $current_template_info);
    $smarty->assign('available_templates', $available_templates);
    $smarty->assign('admin_title', '模板列表');
    $smarty->display('template_list.html');
} elseif ($action == 'select_template') {
    //如果传递的为空,设置为默认模板
    $template_name = !empty($_GET['template_name']) ? trim($_GET['template_name']) : 'default';
    $sql = 'UPDATE ' . table('config') . "  SET `value`='" . $template_name . "' WHERE `key`='template_name'";
    $db->query($sql);
    sys_message('模板设置成功', 'admin.php?act=templates_list');
}
//获取模板信息
开发者ID:az0ne,项目名称:simple_zoomeye,代码行数:31,代码来源:template.php

示例6: check_authz_json

}
/*------------------------------------------------------ */
//-- 安装模版
/*------------------------------------------------------ */
if ($_REQUEST['act'] == 'install') {
    check_authz_json('backup_setting');
    $tpl_name = trim($_GET['tpl_name']);
    $sql = "UPDATE " . $GLOBALS['ecs']->table('shop_config') . " SET value = '{$tpl_name}' WHERE code = 'template'";
    if ($db->query($sql, 'SILENT')) {
        clear_all_files();
        //清除模板编译文件
        $error_msg = '';
        if (move_plugin_library($tpl_name, $error_msg)) {
            make_json_error($error_msg);
        } else {
            make_json_result(get_template_info($tpl_name), $_LANG['install_template_success']);
        }
    } else {
        make_json_error($db->error());
    }
}
/*------------------------------------------------------ */
//-- 备份模版
/*------------------------------------------------------ */
if ($_REQUEST['act'] == 'backup') {
    include_once 'includes/cls_phpzip.php';
    $tpl = trim($_REQUEST['tpl_name']);
    $filename = '../temp/backup/' . $tpl . '_' . date('Ymd') . '.zip';
    $zip = new PHPZip();
    $done = $zip->zip('../themes/' . $tpl . '/', $filename);
    if ($done) {
开发者ID:BGCX261,项目名称:zishashop-svn-to-git,代码行数:31,代码来源:template.php

示例7: post

 /**
  * 更新系统配置
  */
 public function post()
 {
     /* 允许上传的文件类型 */
     $allow_file_types = '|GIF|JPG|PNG|BMP|SWF|DOC|XLS|PPT|MID|WAV|ZIP|RAR|PDF|CHM|RM|TXT|CERT|';
     $arr = array();
     $res = $this->model->table('touch_shop_config')->field('id, value')->select();
     if (is_array($res)) {
         foreach ($res as $vo) {
             $arr[$vo['id']] = $vo['value'];
         }
     }
     foreach (I('value') as $key => $val) {
         if ($arr[$key] != $val) {
             $data['value'] = $val;
             $condition['id'] = $key;
             $this->model->table('touch_shop_config')->data($data)->where($condition)->update();
         }
     }
     /* 处理上传文件 */
     $file_var_list = array();
     $res = $this->model->table('touch_shop_config')->where("parent_id > 0 AND type = 'file'")->select();
     if (is_array($res)) {
         foreach ($res as $vo) {
             $file_var_list[$vo['code']] = $vo;
         }
     }
     foreach ($_FILES as $code => $file) {
         /* 判断用户是否选择了文件 */
         if (isset($file['error']) && $file['error'] == 0 || !isset($file['error']) && $file['tmp_name'] != 'none') {
             /* 检查上传的文件类型是否合法 */
             if (!check_file_type($file['tmp_name'], $file['name'], $allow_file_types)) {
                 $this->message(sprintf(L('msg_invalid_file'), $file['name']), NULL, 'error');
             } else {
                 if ($code == 'shop_logo') {
                     $info = get_template_info(C('template'));
                     $info['logo'] = empty($info['logo']) ? 'logo.png' : $info['logo'];
                     $file_name = str_replace('{$template}', C('template'), $file_var_list[$code]['store_dir']) . $info['logo'];
                 } elseif ($code == 'watermark') {
                     $name = explode('.', $file['name']);
                     $ext = array_pop($name);
                     $file_name = $file_var_list[$code]['store_dir'] . 'watermark.' . $ext;
                     if (file_exists($file_var_list[$code]['value'])) {
                         @unlink($file_var_list[$code]['value']);
                     }
                 } elseif ($code == 'no_picture') {
                     $name = explode('.', $file['name']);
                     $ext = array_pop($name);
                     $file_name = $file_var_list[$code]['store_dir'] . 'no_picture.' . $ext;
                     if (file_exists($file_var_list[$code]['value'])) {
                         @unlink($file_var_list[$code]['value']);
                     }
                 } else {
                     $file_name = $file_var_list[$code]['store_dir'] . $file['name'];
                 }
                 /* 判断是否上传成功 */
                 if (move_upload_file($file['tmp_name'], $file_name)) {
                     $data2['value'] = __ROOT__ . str_replace(array('./', '../'), '/', $file_name);
                     $this->model->table('touch_shop_config')->data($data2)->where("code = '{$code}'")->update();
                 } else {
                     $this->message(sprintf(L('msg_upload_failed'), $file['name'], $file_var_list[$code]['store_dir']), NULL, 'error');
                 }
             }
         }
     }
     /* 处理发票类型及税率 */
     $invoice_rate = I('invoice_rate');
     if (!empty($invoice_rate)) {
         foreach ($invoice_rate as $key => $rate) {
             $rate = round(floatval($rate), 2);
             if ($rate < 0) {
                 $rate = 0;
             }
             I('invoice_rate.' . $key, $rate);
         }
         $invoice = array('type' => I('invoice_type'), 'rate' => I('invoice_rate'));
         $data3['value'] = serialize($invoice);
         $this->model->table('touch_shop_config')->data($data3)->where("code = 'invoice_type'")->update();
     }
     /* 清除缓存 */
     clear_all_files();
     $site_info = site_info();
     $this->cloud->data($site_info)->act('post.record');
     $this->message(L('save_success'), url('index'));
 }
开发者ID:noikiy,项目名称:shop-3,代码行数:87,代码来源:ConfigController.class.php

示例8: get_email_templates

   <tr><th>Template Name</th>
   <th>Subject</th>
   <th>Content Excerpt</th>
   <th>Action</th></tr>
<?php 
    $templates = get_email_templates();
    $shade = false;
    foreach ($templates as $t) {
        $class = '';
        if ($shade) {
            $class = ' class="rowshade"';
            $shade = false;
        } else {
            $shade = true;
        }
        $info = get_template_info($t);
        ?>
      <tr<?php 
        echo $class;
        ?>
><td>
      <?php 
        echo $info['templatename'];
        ?>
      </td><td>
      <?php 
        echo $info['subject'];
        ?>
      </td><td>
      <?php 
        echo substr_replace($info['content'], '...', 125);
开发者ID:adriculous,项目名称:enthusiast,代码行数:31,代码来源:emails.php

示例9: opendir

        $current_template_info = '';
    }
    if (!file_exists(SABLOG_ROOT . $template_dir . $options['templatename'] . '/screenshot.png')) {
        $current_template_info['screenshot'] = $template_dir . 'no.png';
    } else {
        $current_template_info['screenshot'] = $template_dir . $options['templatename'] . '/screenshot.png';
    }
    $dir1 = opendir(SABLOG_ROOT . $template_dir);
    $available_template_db = array();
    while ($file1 = readdir($dir1)) {
        if ($file1 != '' && $file1 != '.' && $file1 != '..' && $file1 != 'admin' && $file1 != $options['templatename']) {
            if (is_dir($template_dir . '/' . $file1)) {
                $dir2 = opendir($template_dir . '/' . $file1);
                while ($file2 = readdir($dir2)) {
                    if (is_file(SABLOG_ROOT . $template_dir . '/' . $file1 . '/' . $file2) && $file2 == 'info.txt') {
                        $available_template_db[] = get_template_info($file1 . '/' . $file2);
                    }
                }
                closedir($dir2);
            }
        }
    }
    closedir($dir1);
    unset($file1);
    $subnav = '选择模板';
}
//模板套系中的文件列表
if ($action == 'filelist') {
    require_once SABLOG_ROOT . 'include/func/attachment.func.php';
    $dir = $template_dir . $path;
    $fp = opendir($dir);
开发者ID:BGCX261,项目名称:zjnewcitycode-svn-to-git,代码行数:31,代码来源:template.php

示例10: select_tpl

function select_tpl()
{
    global $db, $tpf, $settings;
    $q = $db->query("select * from {$tpf}templates where tpl_type='user'");
    $tpl_sw = array();
    while ($rs = $db->fetch_array($q)) {
        $arr = get_template_info($rs[tpl_name]);
        $rs[tpl_title] = $arr[tpl_title];
        $rs['tpl_href'] = $settings[phpdisk_url] . '?tpl=' . $rs['tpl_name'] . '&ref=' . base64_encode($_SERVER['REQUEST_URI']);
        if ($arr[authed_tpl] == 2 || !$arr[authed_tpl]) {
            $tpl_sw[] = $rs;
        }
    }
    $db->free($q);
    unset($rs);
    return $tpl_sw;
}
开发者ID:saintho,项目名称:phpdisk,代码行数:17,代码来源:global.func.php


注:本文中的get_template_info函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。