Zend Framework Controller File (Apple Icons)

天涯浪子 提交于 2019-12-11 05:56:32

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!