November 6, 2011

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

Question by mrN

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?

Answer by Starx

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);

Author: Nabin Nepal (Starx)

Hello, I am Nabin Nepal and you can call me Starx. This is my blog where write about my life and my involvements. I am a Software Developer, A Cyclist and a Realist. I hope you will find my blog interesting. Follow me on Google+

...

Please fill the form - I will response as fast as I can!