问题
Question about including some header information in controller file in zend framework. I am wanting to include the apple icons. Going off of this here: http://gigaom.com/apple/how-to-create-ios-device-home-screen-icons-for-web-sites/
However the 'sizes' block is not showing up when I look at the actual source of page that this is on. I'm assuming rel and href are native to zend framework already. How do I get the 'sizes' to show up?
$this->view->headLink(array('rel' => 'apple-touch-icon', 'href' => '/images/icons/apple-touch-icon.png'));
$this->view->headLink(array('rel' => 'apple-touch-icon', 'sizes' => '72x72', 'href' => '/images/icons/apple-touch-icon-72x72.png'));
$this->view->headLink(array('rel' => 'apple-touch-icon', 'sizes' => '114x114', 'href' => '/images/icons/apple-touch-icon-114x114.png'));
This is what is actually showed upon viewing source of page in header.
<link href="/images/icons/apple-touch-icon.png" rel="apple-touch-icon" />
<link href="/images/icons/apple-touch-icon-72x72.png" rel="apple-touch-icon" />
<link href="/images/icons/apple-touch-icon-114x114.png" rel="apple-touch-icon" />
Thanks
回答1:
Your sizes and any other attributes not supported out-of-the-box by headLink() should go in an extras array, like so:
$this->view->headLink(array('rel' => 'apple-touch-icon',
'href' => '/images/icons/apple-touch-icon.png'));
$this->view->headLink(array('rel' => 'apple-touch-icon',
'href' => '/images/icons/apple-touch-icon-72x72.png',
'extras' => array('sizes' => '72x72')));
$this->view->headLink(array('rel' => 'apple-touch-icon',
'href' => '/images/icons/apple-touch-icon-114x114.png',
'extras' => array('sizes' => '114x114')));
(Lines wrapped for clarity.)
来源:https://stackoverflow.com/questions/11654924/zend-framework-controller-file-apple-icons