如何在Zend框架中添加js文件时定义自定义属性

How to define custom attributes while appending a js file in Zend Framewok?

本文关键字:文件 js 定义 自定义属性 添加 Zend 框架      更新时间:2023-09-26

我正在尝试在我的zf应用程序中实现内容流。当加载它的属性时,它需要定义一个额外的属性。

<script type="text/javascript" src=".." load="white"></script>

为了使用zf来解释这个,我尝试了

$this -> headScript() -> appendFile("my/path/to/contentflow.js","text/javascript", array("load" => "white")); 

但是它不工作。

如何做到这一点?

Zend Framework不允许这样的随机属性。如果你真的需要使用它们,你必须使用

来启用它们
$this -> headScript() -> setAllowArbitraryAttributes(true);