Zend Framework Adds HTML5 Scripts and Style Sheets

I am interested in using the Zend Framework view helpers, ... below ...

$this->headLink()->prependStylesheet("css/style.css") ->prependStylesheet("css/prettify.css") ->prependStylesheet("css/960.css") ->prependStylesheet("css/text.css") ->prependStylesheet("css/reset.css"); $this->headScript()->prependFile("js/site.js") ->prependFile("http://www.google.com/jsapi"); echo $this->headLink(); echo $this->headScript(); 

displayed

 <link href="css/reset.css" media="screen" rel="stylesheet" type="text/css" > <link href="css/text.css" media="screen" rel="stylesheet" type="text/css" > <link href="css/960.css" media="screen" rel="stylesheet" type="text/css" > <link href="css/prettify.css" media="screen" rel="stylesheet" type="text/css" > <link href="css/style.css" media="screen" rel="stylesheet" type="text/css" > <script type="text/javascript" src="http://www.google.com/jsapi"></script> <script type="text/javascript" src="js/site.js"></script> 

how can I echo html5 links and scripts where I don’t need type="text/javascript" and rel="stylesheet" all that

+4
source share
3 answers

You can create your ouwn helper and put it in your view / helpers / Headlink.php, exrtend the original Zend Framework and just override the part you want to make another.

Of course, the best option, and then editing the Framework files ...

+2
source

Simply pass a null or null attribute value to the helper or create your own helper (with the same name but in a different namespace), overloading the default helper's default behavior.

Making changes to the source frame files is not a good solution.

+1
source

zf/library/Zend/View/Helper/HeadLink.php :

in createDataStylesheet function

try changing this:

 $attributes = compact('rel', 'type', 'href', 'media', 'conditionalStylesheet', 'extras'); 

to this (or whatever)

 $attributes = compact('type', 'href', 'media', 'conditionalStylesheet', 'extras'); 

If it works, you can create your own helper that inherits the default Zend value and overrides this method.

And in case of js try to do:

 ...->prependFile('yourfile.js', ''); 
0
source

Source: https://habr.com/ru/post/1315756/


All Articles