【发布时间】:2021-01-22 23:55:58
【问题描述】:
我正在使用 CakePHP 3.9
我正在尝试在我的视图单元中设置 css / 脚本依赖块。
我希望在我的布局头部中获取它,但它不起作用。如果我想让它工作,我必须在调用单元之前/之后在视图中设置 css 依赖项。
有没有办法在 View Cell 中设置 css 依赖项?
我的看法:
<?= $this->cell('Post::post_input'); ?>
....
我的视图单元格:
<?php echo $this->Html->css(['element/post-input'], ['block' => true]); ?>
<div class="post-input">...</div>
我的布局:
<html>
<head>
...
<?php
echo $this->fetch('css');
echo $this->fetch('script');
?>
...
</head>
<body>
<?php echo $this->fetch('content'); ?>
</body>
</html>
【问题讨论】:
标签: cakephp cakephp-3.x cakephp-helper