为什么在我实施 ZF2 ACL 时 javascript 停止工作?
Why did javascript stop working when I implemented ZF2 ACL?
我在 Zend Framework 2 应用程序中使用 Bootstrap。在我实施 ACL 控件之前,格式看起来不错。现在唯一一次格式化按钮是当用户的角色是来宾时。关于哪里出了问题有什么想法吗?
@Zend Framework2 各位:ACL 列表中是否需要包含 css 和 js 文件?
来自 config/autoload/acl.global.php 的 ACL 控件看起来像:
return array(
'acl' => array(
'roles' => array(
'guest' => null,
'member' => 'guest',
'mentor' => 'member',
'board' => 'mentor',
'admin' => 'board',
),
'resources' => array(
'allow' => array(
'Register\Controller\Profile' => array(
'index' => 'guest',
'confirm' => 'member',
'process' => 'guest',
'edit' => 'member',
'saveEdit' => 'member',
'family' => 'member',
'delete' => 'member',
),
'Register\Controller\Index' => array(
'index' => 'guest',
'profile' => 'guest',
'login' => 'guest',
),
...and so forth for each controller and action (no other resources are included)
这里是页面布局模板,默认-layout.phtml显示唯一javascript我使用或拉入:
<?php echo $this->doctype(); ?>
<html lang="en">
<head>
<meta charset="utf-8">
<?php echo $this->headTitle('TJLA Registration')->setSeparator(' - ')->setAutoEscape(false) ?>
<?php echo $this->headMeta()
->appendName('viewport', 'width=device-width, initial-scale=1.0')
->appendHttpEquiv('X-UA-Compatible', 'IE=edge')
?>
<!-- Styles -->
<?php echo $this->headLink(array('rel' => 'shortcut icon', 'type' => 'image/vnd.microsoft.icon', 'href' => $this->basePath() . '/img/tjla-tree.png'))
->prependStylesheet($this->basePath() . '/css/style.css')
->prependStylesheet($this->basePath() . '/css/bootstrap-theme.min.css')
->prependStylesheet($this->basePath() . '/css/bootstrap.min.css');
?>
</head>
<body>
<div class="masthead">
</div>
<nav class="navbar navbar-default" role="navigation">
<div class="container navbar-container">
<div class="navbar-header">
</div>
<div class="collapse navbar-collapse">
<?php echo $this->navigation('navigation')->menu()->setUlClass('nav navbar-nav'); ?>
</div><!--/.nav-collapse -->
</div>
</nav>
<div class="container">
<?php echo $this->content; ?>
<hr>
<footer>
<p>© <?php echo date('Y') ?> by Thomas Jefferson Leadership Academy. All rights reserved.</p>
</footer>
</div> <!-- /container -->
<!-- Scripts -->
<?php echo $this->inlineScript()
->appendFile($this->basePath() . '/js/jquery.min.js')
->appendFile($this->basePath() . '/js/bootstrap.min.js')
->appendFile($this->basePath() . '/js/respond.min.js', 'text/javascript', array('conditional' => 'lt IE 9',))
->appendFile($this->basePath() . '/js/html5shiv.js', 'text/javascript', array('conditional' => 'lt IE 9',));
?>
<script>
$(function () {
$('[data-toggle="popover"]').popover()
})
</script>
</body>
</html>
请原谅我浪费了你的时间。我发现了问题;该页面被以前的版本覆盖,锚点中缺少正确的 class。 (角色="button"class="btn btn-xs btn-primary")
我在 Zend Framework 2 应用程序中使用 Bootstrap。在我实施 ACL 控件之前,格式看起来不错。现在唯一一次格式化按钮是当用户的角色是来宾时。关于哪里出了问题有什么想法吗?
@Zend Framework2 各位:ACL 列表中是否需要包含 css 和 js 文件?
来自 config/autoload/acl.global.php 的 ACL 控件看起来像:
return array(
'acl' => array(
'roles' => array(
'guest' => null,
'member' => 'guest',
'mentor' => 'member',
'board' => 'mentor',
'admin' => 'board',
),
'resources' => array(
'allow' => array(
'Register\Controller\Profile' => array(
'index' => 'guest',
'confirm' => 'member',
'process' => 'guest',
'edit' => 'member',
'saveEdit' => 'member',
'family' => 'member',
'delete' => 'member',
),
'Register\Controller\Index' => array(
'index' => 'guest',
'profile' => 'guest',
'login' => 'guest',
),
...and so forth for each controller and action (no other resources are included)
这里是页面布局模板,默认-layout.phtml显示唯一javascript我使用或拉入:
<?php echo $this->doctype(); ?>
<html lang="en">
<head>
<meta charset="utf-8">
<?php echo $this->headTitle('TJLA Registration')->setSeparator(' - ')->setAutoEscape(false) ?>
<?php echo $this->headMeta()
->appendName('viewport', 'width=device-width, initial-scale=1.0')
->appendHttpEquiv('X-UA-Compatible', 'IE=edge')
?>
<!-- Styles -->
<?php echo $this->headLink(array('rel' => 'shortcut icon', 'type' => 'image/vnd.microsoft.icon', 'href' => $this->basePath() . '/img/tjla-tree.png'))
->prependStylesheet($this->basePath() . '/css/style.css')
->prependStylesheet($this->basePath() . '/css/bootstrap-theme.min.css')
->prependStylesheet($this->basePath() . '/css/bootstrap.min.css');
?>
</head>
<body>
<div class="masthead">
</div>
<nav class="navbar navbar-default" role="navigation">
<div class="container navbar-container">
<div class="navbar-header">
</div>
<div class="collapse navbar-collapse">
<?php echo $this->navigation('navigation')->menu()->setUlClass('nav navbar-nav'); ?>
</div><!--/.nav-collapse -->
</div>
</nav>
<div class="container">
<?php echo $this->content; ?>
<hr>
<footer>
<p>© <?php echo date('Y') ?> by Thomas Jefferson Leadership Academy. All rights reserved.</p>
</footer>
</div> <!-- /container -->
<!-- Scripts -->
<?php echo $this->inlineScript()
->appendFile($this->basePath() . '/js/jquery.min.js')
->appendFile($this->basePath() . '/js/bootstrap.min.js')
->appendFile($this->basePath() . '/js/respond.min.js', 'text/javascript', array('conditional' => 'lt IE 9',))
->appendFile($this->basePath() . '/js/html5shiv.js', 'text/javascript', array('conditional' => 'lt IE 9',));
?>
<script>
$(function () {
$('[data-toggle="popover"]').popover()
})
</script>
</body>
</html>
请原谅我浪费了你的时间。我发现了问题;该页面被以前的版本覆盖,锚点中缺少正确的 class。 (角色="button"class="btn btn-xs btn-primary")