Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I am trying to implement content flow in my zf application. And while loading its attributes, it requires one extra attribute to be defined.

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

To interprete this using zf, i tried

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

But its not working.

How to do this?

like image 549
mrN Avatar asked Nov 06 '11 11:11

mrN


People also ask

What is the difference between predefined and custom attributes?

Attributes are extra information that provide for the HTML elements. There are lots of predefined attributes in HTML. When the predefined attributes do not make sense to store extra data, custom attributes allow users to create custom data.

What are custom attributes in JavaScript?

This example could be for a retail site with different product categories. The custom attributes allow you to treat elements in particular ways within the JavaScript code for the page, for example when using animated display functions.

How do I add custom attributes to a selected element?

You can add custom attributes to a selected element in the Element Settings panel. Add a new custom attribute (button with plus icon) Add a new custom attribute for the selected element. Name (data input field)

How difficult is it to implement custom attributes in HTML5?

Implementing custom attributes in HTML5 is not technically complex in itself, however the real difficulty is in choosing whether it is appropriate to use them in your own projects, and if so how to go about it efficiently.


1 Answers

Zend Framework does not allow such random attributes. If you really have to use them, you have to enable them using

$this -> headScript() -> setAllowArbitraryAttributes(true);
like image 150
Starx Avatar answered Oct 26 '22 05:10

Starx