本文整理汇总了PHP中Assets::addJS方法的典型用法代码示例。如果您正苦于以下问题:PHP Assets::addJS方法的具体用法?PHP Assets::addJS怎么用?PHP Assets::addJS使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Assets
的用法示例。
在下文中一共展示了Assets::addJS方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index(array $params = [])
{
Assets::addCSS('svgtree-0.3.0.min.css');
Assets::addCSS('main.css');
Assets::addJS('jsrender.min.js');
Assets::addJS('db.js');
Assets::addJS('main.js');
Assets::addJS('search.js');
Assets::addJS('svgtree-0.3.0.min.js');
Assets::addJS('trees.js');
$this->SearchModel = $this->loader->loadModel('Search');
if (isset($_POST['words'])) {
$words = json_decode($_POST['words']);
$results = $this->SearchModel->searchFromKeywords($words);
$response = [];
// if we have some results to handle
if ($results) {
// count values
$results = array_count_values($results);
// sort by count
arsort($results);
// keep only sorted links id
$results = array_keys($results);
foreach ($results as $linkId) {
$link = $this->SearchModel->getLink($linkId);
if ($link) {
$response[] = $link;
}
}
}
echo json_encode($response);
exit;
}
$this->loader->loadView('index', $this->data, true);
}
示例2: __construct
public function __construct()
{
// loader
$this->loader = new Loader();
$this->AuthModel = $this->loader->loadModel('Auth');
// assets management
Assets::addCSS('bootstrap.css');
Assets::addCSS('sticky-footer.css');
Assets::addCSS('ie10-viewport-hack.css');
Assets::addJS('jquery-1.11.3.min.js');
Assets::addJS('bootstrap.min.js');
}
示例3: jQuery
dialog.dialog('open');
for(var i = 0; i < fieldOrder.length; i++)
{
jQuery('#edit'+fieldOrder[i]).val('').css('background-color', '').css('color', '');
}
return false;
});
jQuery('.editLink').bind('click', editClick);
<?php
foreach ($fields as $fieldKey => $fieldData) {
if ($fieldData['type'] == 'date') {
echo "jQuery('#edit{$fieldKey}').datepicker({dateFormat: 'yy-mm-dd',});\n";
} else {
if ($fieldData['type'] == 'color') {
Assets::addJS('jscolor.js', 100);
?>
jscolor.dir = '<?php
echo url::site('static/img/jscolor_');
?>
';
<?php
}
}
}
?>
});
-->
</script>