本文整理汇总了PHP中TPL::discardOutputStream方法的典型用法代码示例。如果您正苦于以下问题:PHP TPL::discardOutputStream方法的具体用法?PHP TPL::discardOutputStream怎么用?PHP TPL::discardOutputStream使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TPL
的用法示例。
在下文中一共展示了TPL::discardOutputStream方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tpExe
/**
* Will execute the passed .tp FilePath, and extract the variables as references (or overwrites). Assigning the variables is
* not enough. You need to make a CALL to TPL::tpExe ($tpF) to execute the specified $tpF file;
*
* @param string $tpFileName The path to the .tp file to be executed
* @param boolean $tpAsAJAXResponse Set to TRUE when echo'ing the .tp as an AJAX response
* @return boolean Will return true if the file has been executed properly
* @author Catalin Z. Alexandru <catalin.zamfir@raphpframework.ro>
* @copyright Under the terms of the GNU General Public License v3
* @version $Id: 10_TPL.php 315 2009-10-11 07:11:31Z catalin.zamfir $
* @since Version 1.0
* @access public
* @static
* @final
*/
public static final function tpExe(FilePath $tpFileName, B $tpAsAJAXResponse = NULL)
{
// Set some requirements ...
if ($tpAsAJAXResponse == NULL) {
$tpAsAJAXResponse = new B(FALSE);
}
// Make sure we're actually there ...
if ($tpFileName->checkPathExists()) {
self::$objFilePathArray[$tpFileName]['dummy_' . $_SERVER['REQUEST_TIME']] = new S('do_not_cache');
if (extract(self::$objFilePathArray[$tpFileName]->toArray(), EXTR_REFS)) {
// If it's an AJAX request for HTML, CLEAN it;
if ($tpAsAJAXResponse->toBoolean() == TRUE) {
TPL::discardOutputStream(new B(TRUE));
TPL::switchHTML();
}
// Require the template file ...
require $tpFileName->toString();
// Unset all predefined variables, for a memory clean-up;
unset(self::$objFilePathArray[$tpFileName]);
// Do me a favor and STOP right here ...
if ($tpAsAJAXResponse->toBoolean() == TRUE) {
// DIE;
TPL::disableFurtherOutput();
}
// Return the status;
return new B(TRUE);
} else {
self::renderScreenOfDeath(new S(__CLASS__), new S(CANNOT_EXTRACT_VARS), new S(CANNOT_EXTRACT_VARS_FIX));
}
} else {
self::renderScreenOfDeath(new S(__CLASS__), new S(FILE_DOESNT_EXIST), new S(FILE_DOESNT_EXIST_FIX));
}
}