/** * * 压缩当前的模板Token */ public function compress($tpl, Fl_Base &$instance) { $tplText = $instance->getTplText($tpl); //smarty的extends后必须有个空白字符 if (strpos($tplText, 'extends ') === 0) { $tpl .= ' '; } return $tpl; }
/** * * 检测当前的tpl是否会输出 * @param string $tpl */ public function checkHasOutput($tpl, Fl_Base &$instance) { $tplText = $instance->getTplText($tpl, true); //目前只处理 {{{ a }}} 的情况 if ($tplText[0] === '{') { return true; } return false; // $reg = "/^[A-Za-z\.]+/"; // if (! preg_match ( $reg, $tplText )) { // return false; // } // foreach ( $this->keywords as $keyword ) { // if (strpos ( $tplText, $keyword ) === 0) { // return false; // } // } // return true; }