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


PHP Smarty::clearCompiledTemplate方法代码示例

本文整理汇总了PHP中Smarty::clearCompiledTemplate方法的典型用法代码示例。如果您正苦于以下问题:PHP Smarty::clearCompiledTemplate方法的具体用法?PHP Smarty::clearCompiledTemplate怎么用?PHP Smarty::clearCompiledTemplate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Smarty的用法示例。


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

示例1: render

 public function render($name, array $values = array())
 {
     if (defined('ENV_DEV')) {
         //$this->engine->clearCacheFiles();
         //$this->engine->clearTemplateCache();
         $this->engine->clearAllCache();
         $this->engine->clearCompiledTemplate();
     }
     $template = $this->engine->createTemplate($name . $this->suffix);
     $template->assign($values);
     return $template->fetch();
 }
开发者ID:php-nik,项目名称:core,代码行数:12,代码来源:SmartyProvider.php

示例2: tpl_display

function tpl_display($view = '', $vars = array())
{
    $dir_sep = DIRECTORY_SEPARATOR;
    $dir_base = __DIR__ . $dir_sep;
    $dir_smarty = $dir_base . implode($dir_sep, array('..', 'smarty-3.1.16', 'libs', ''));
    $dir_tpls = $dir_base . 'tpls' . $dir_sep;
    $dir_tplc = $dir_base . 'tplc' . $dir_sep;
    $dir_plgs = $dir_base . 'plugins' . $dir_sep;
    require_once $dir_smarty . 'Smarty.class.php';
    $smarty = new Smarty();
    $smarty->left_delimiter = '<%';
    $smarty->right_delimiter = '%>';
    $smarty->setTemplateDir($dir_tpls);
    $smarty->setCompileDir($dir_tplc);
    $smarty->addPluginsDir($dir_plgs);
    $smarty->registerFilter('pre', 'tpl_pre_filter');
    if (isset($vars['debug'])) {
        $smarty->force_compile = true;
    }
    $smarty->assign($vars);
    $smarty->display($view . '.tpl');
    if (isset($vars['debug'])) {
        $smarty->clearCompiledTemplate();
    }
}
开发者ID:i6ma,项目名称:snp,代码行数:25,代码来源:viewer.php

示例3:

 /**
  * Deletes all compiled templates.
  */
 function delete_compiled_templates()
 {
     $save_compile_id = $this->smarty->compile_id;
     $this->smarty->compile_id = null;
     $this->smarty->clearCompiledTemplate();
     $this->smarty->compile_id = $save_compile_id;
     file_put_contents($this->smarty->getCompileDir() . '/index.htm', 'Not allowed!');
 }
开发者ID:squidjam,项目名称:Piwigo,代码行数:11,代码来源:template.class.php

示例4: check_compile_cache_invalidation

 /**
  * Check the compile cache needs to be invalidated (multi front + local cache compatible)
  */
 public function check_compile_cache_invalidation()
 {
     static $last_flush = null;
     if (!file_exists($this->getCompileDir() . 'last_flush')) {
         @touch($this->getCompileDir() . 'last_flush');
     } elseif (defined('_DB_PREFIX_')) {
         if ($last_flush === null) {
             $sql = 'SELECT UNIX_TIMESTAMP(last_flush) as last_flush FROM `' . _DB_PREFIX_ . 'smarty_last_flush` WHERE type=\'compile\'';
             $last_flush = Db::getInstance()->getValue($sql, false);
         }
         if ((int) $last_flush && @filemtime($this->getCompileDir() . 'last_flush') < $last_flush) {
             @touch($this->getCompileDir() . 'last_flush');
             parent::clearCompiledTemplate();
         }
     }
 }
开发者ID:jpodracky,项目名称:dogs,代码行数:19,代码来源:SmartyCustom.php

示例5: dirname

 * not, see:
 *
 * @link <http://www.gnu.org/licenses/>.
 * @author niel
 * @copyright 2014 nZEDb
 */
require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . 'www' . DIRECTORY_SEPARATOR . 'config.php';
use nzedb\db\DbUpdate;
use nzedb\utility\Utility;
if (!Utility::isCLI()) {
    exit;
}
if (isset($argc) && $argc > 1 && isset($argv[1]) && $argv[1] == true) {
    $backup = isset($argv[2]) && $argv[2] == 'safe' ? true : false;
    $updater = new DbUpdate(['backup' => $backup]);
    echo $updater->log->header("Db updater starting ...");
    $patched = $updater->processPatches(['safe' => $backup]);
    if ($patched > 0) {
        echo $updater->log->info("{$patched} patch(es) applied.");
        $smarty = new Smarty();
        $cleared = $smarty->clearCompiledTemplate();
        if ($cleared) {
            $msg = "The smarty template cache has been cleaned for you\n";
        } else {
            $msg = "You should clear your smarty template cache at: " . SMARTY_DIR . "templates_c\n";
        }
        $updater->log->info($msg);
    }
} else {
    echo "Usage: php update_db.php true";
}
开发者ID:sebst3r,项目名称:nZEDb,代码行数:31,代码来源:update_db.php

示例6: ClearCompiledTemplates

 /**
  * Очищает кеш компиленных шаблонов
  */
 public function ClearCompiledTemplates()
 {
     $this->oSmarty->clearCompiledTemplate();
 }
开发者ID:vgrish,项目名称:livestreet-framework,代码行数:7,代码来源:Viewer.class.php

示例7: execute

 /**
  * Execute compile command
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     //get project name & set source/output dirs
     $project = $input->getArgument('project');
     $this->config = new \Implico\Email\Config($project, $input->getOption('dir'));
     if ($error = $this->config->getErrors()) {
         switch ($error) {
             case 'projectNotFound':
                 $output->writeln('<fg=red>ERROR: project directory not found</fg=red>');
                 exit(1);
                 break;
         }
     }
     SmartyUtils::init($this->config);
     //get script name(s)
     $scripts = $input->getOption('script');
     //if script name(s) not passed, set all scripts (exclude dirs)
     if (!$scripts) {
         $scripts = array_filter(array_diff(scandir($this->config['scriptsDir']), array('.', '..')), function ($script) {
             return !is_dir($this->config['scriptsDir'] . $script);
         });
     }
     //add ".tpl" extension when applicable
     foreach ($scripts as $i => $script) {
         if (strpos($script, '.') === false) {
             $scripts[$i] = $script . '.tpl';
         }
     }
     //get watch option
     $watch = $input->getOption('watch');
     //get output option
     $outputMode = $input->getOption('output');
     //create & configure Smarty object
     $smarty = new \Smarty();
     $smarty->setCompileDir(IE_SMARTY_COMPILE_DIR);
     $smarty->addPluginsDir(IE_SMARTY_PLUGINS_DIR);
     $smarty->addPluginsDir(IE_SMARTY_CUSTOM_PLUGINS_DIR);
     $smarty->compile_check = false;
     $smarty->force_compile = true;
     $smarty->error_reporting = E_ALL;
     $smarty->registerClass('SmartyUtils', 'Implico\\Email\\Utils\\Smarty');
     //set directories
     $smarty->setTemplateDir(array(0 => $this->config['dir'], 'core' => IE_CORE_DIR, 'layouts' => $this->config['layoutsDir'], 'scripts' => $this->config['scriptsDir'], 'styles' => $this->config['stylesDir']));
     //master config file
     $smarty->configLoad(IE_CORE_DIR . 'config.conf');
     //optional master custom config file
     $customConf = IE_CUSTOM_DIR . 'config.conf';
     if (file_exists($customConf)) {
         $smarty->configLoad($customConf);
     }
     //console message for watching
     if ($watch) {
         $output->writeln('Watching for changes...');
     }
     //main loop - watch for changes (or execute once if not watching)
     $compileNo = 1;
     $compileDirStamp = '';
     //dirs to inspect file change
     $checkDirs = array($this->config['configsDir'], $this->config['configsScriptsDir'], $this->config['layoutsDir'], $this->config['scriptsDir'], $this->config['stylesDir']);
     //set output mode variables
     $outputMinified = in_array('m', $outputMode);
     $outputFormatted = in_array('f', $outputMode);
     //formatter object
     $formatter = null;
     //css inliner object
     $cssToInlineStyles = new CssToInlineStyles();
     while (true) {
         //compile only if not watching or the dirs filestamp changes
         if (!$watch || $compileDirStamp != $this->getDirStamp($checkDirs)) {
             //clear compiled templates
             $smarty->clearCompiledTemplate();
             //Smarty assign project-specific config file path
             $configFile = $this->config['configsDir'] . 'config.conf';
             $loadConfigFile = file_exists($configFile);
             //set random complile_id (forces Smarty to compile)
             $smarty->compile_id = uniqid();
             //list of compiled scripts
             $compiledScripts = $scripts;
             //fetch & save templates
             foreach ($scripts as $i => $script) {
                 //script name without extension
                 $scriptName = substr($script, 0, strrpos($script, '.'));
                 $smarty->clearConfig();
                 if ($loadConfigFile) {
                     $smarty->configLoad($configFile);
                 }
                 //set script-specific config file path if exists
                 $configFileScript = $this->config['configsScriptsDir'] . $scriptName . '.conf';
                 if (file_exists($configFileScript)) {
                     $smarty->configLoad($configFileScript);
                 }
                 //lazy create indenter
                 if ($outputFormatted && !$formatter) {
                     $formatter = new \Gajus\Dindent\Indenter(array('indentation_character' => $smarty->getConfigVars('indentChar')));
                 }
                 //set encoding
                 $outputEncoding = $smarty->getConfigVars('encoding');
//.........这里部分代码省略.........
开发者ID:implico,项目名称:email-framework,代码行数:101,代码来源:Compile.php


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