本文整理匯總了PHP中Tpl::countTemplates方法的典型用法代碼示例。如果您正苦於以下問題:PHP Tpl::countTemplates方法的具體用法?PHP Tpl::countTemplates怎麽用?PHP Tpl::countTemplates使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Tpl
的用法示例。
在下文中一共展示了Tpl::countTemplates方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: fixPath
<?php
namespace Rain;
require_once "Tpl.php";
function fixPath(&$path)
{
$path = preg_replace(array("#(/{2,})#", "#(/\\./+)#"), array("/", "/"), $path);
$path = str_replace("/", "\\", $path);
}
$tpl = new Tpl();
$tpl->configure(array("tpl_dir" => "../templates/"));
$fs = $tpl->countTemplates();
$grid = (new Db())->countTemplates();
echo "Count templates filesystem: " . $fs['count'] . "<br />";
echo "Count templates in cache: " . $grid['count'] . "<br /><br />";
array_walk($fs['names'], 'Rain\\fixPath');
array_walk($grid['names'], 'Rain\\fixPath');
if ($fs['count'] != $grid['count']) {
echo "Not ready for production yet!<br />";
echo "Missing templates in cache:<br />";
foreach ($fs['names'] as $f) {
if (!in_array($f, $grid['names'])) {
echo $f . "<br />";
}
}
} else {
echo "Ready for production!";
}
#echo "<br />";
#print_r($fs['names']);