简体   繁体   English

如何在锂中渲染图标图标?

[英]How do I render favicons in Lithium?

How would I render favicons in Lithium? 我将如何在锂中渲染图标?

Right now I have this in my layouts: 现在,我的布局中有这个:

<?php echo $this->html->link('Icon', null, array('type' => 'icon')); ?>

However, the favicon doesn't show up. 但是,该图标不会显示。 Attempting to view the favicon resource via Chrome Inspector shows me a broken image. 尝试通过Chrome Inspector查看网站图标资源会显示损坏的图像。

I tried downloading the image via HTTP and the image is empty: 我尝试通过HTTP下载图像,但图像为空:

$ wget http://example.org/favicon.ico
--2012-05-17 00:13:58--  http://example.org/favicon.ico
Resolving example.org... xx.xx.xx.xxx
Connecting to example.org|xx.xx.xx.xxx|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 0 [image/x-icon]
Saving to: `favicon.ico'

    [ <=>                                                                   ] 0           --.-K/s   in 0s      

2012-05-17 00:13:59 (0.00 B/s) - `favicon.ico' saved [0/0]

However, if I scp the image to my local disk and view it, I can view the proper favicon image in the correct format. 但是,如果我将映像scp到本地磁盘并进行查看,则可以以正确的格式查看正确的favicon映像。

Do I have to setup a custom media type or something? 我是否需要设置自定义媒体类型或其他内容? If so, how would I do that for a resource such as an image (favicon)? 如果是这样,我将如何处理图像(网站图标)之类的资源? I'm assuming this is not necessary and that rendering a favicon is possible, by default. 我假设这不是必需的,并且默认情况下可以渲染favicon。

EDIT I forgot to mention that I can view the favicon via HTTP when I view it locally (development environment) but when I try to view it remotely (production environment), the favicon doesn't render as it should. 编辑我忘了提一下,当我在本地(开发环境)查看它时,可以通过HTTP查看该favicon,但是当我尝试远程查看(生产环境)时,该favicon不能正常显示。

EDIT 2 My rewrite rules: 编辑2我的重写规则:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !favicon.ico$
    RewriteRule ^ index.php [QSA,L]
</IfModule>

Thanks. 谢谢。

EDIT 3 I've set up a test Lithium app: http://dev.koobi.co/favicon/ 编辑3我已经建立了一个测试锂应用程序: http : //dev.koobi.co/favicon/

The only thing I changed was the layout file and config/bootstrap/libraries.php 我唯一更改的是布局文件和config/bootstrap/libraries.php

As you can see, the icon file doesn't load for this either. 如您所见,图标文件也不会为此加载。

There is nothing special you have to do. 您没有特别的事情要做。 Double check that a valid favicon.ico is available in webroot/ directory. 仔细检查webroot /目录中是否有有效的favicon.ico。 Lithium comes with a favicon you can use. 锂带有您可以使用的图标。

Turns out this was an issue with Hostgator. 原来这是Hostgator的问题。 Lithium was working perfectly. 锂电池运转良好。 Apparently, Hostgators Apache rules don't allow favicons to be rendered dynamically. 显然,Hostgators Apache规则不允许动态显示网站图标。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM