本文整理匯總了PHP中Smarty_Internal_Template::add_js方法的典型用法代碼示例。如果您正苦於以下問題:PHP Smarty_Internal_Template::add_js方法的具體用法?PHP Smarty_Internal_Template::add_js怎麽用?PHP Smarty_Internal_Template::add_js使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Smarty_Internal_Template
的用法示例。
在下文中一共展示了Smarty_Internal_Template::add_js方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: ia_print_js
public static function ia_print_js($params, Smarty_Internal_Template &$smarty)
{
$smarty->add_js($params);
if (!isset($params['display'])) {
return '';
}
$iaCore = iaCore::instance();
$resources = self::_arrayCopyKeysSorted($iaCore->iaView->resources->js->toArray());
$output = '';
foreach ($resources as $resource) {
switch (true) {
case strpos($resource, 'code:') === 0:
if ($code = trim(substr($resource, 5))) {
$output .= PHP_EOL . "\t" . '<script type="text/javascript"><!-- ' . PHP_EOL . $code . PHP_EOL . ' --></script>';
}
continue;
case strpos($resource, 'text:') === 0:
if (iaUsers::hasIdentity() && iaCore::ACCESS_ADMIN == iaCore::instance()->getAccessType()) {
$text = trim(substr($resource, 5));
$output .= "<script type=\"text/javascript\">if(document.getElementById('js-ajax-loader-status'))document.getElementById('js-ajax-loader-status').innerHTML = '" . $text . "';</script>" . PHP_EOL;
}
continue;
default:
$output .= PHP_EOL . "\t" . sprintf(self::LINK_SCRIPT_PATTERN, $resource);
}
}
return $output;
}