Posted 12 April 2011 - 02:36 PM
Sorry should have included that. I am using that file.
I am using XAMPP on MAC and on initial load of a website it displays the XAMPP favicon. When I change it to mine is then displays the default browser favicon. Maybe XAMPP is causing me these problems since apparently I am modifying the correct file. I will test in another environment.
Posted 28 April 2011 - 03:47 AM
You can use script like this at layouts/main.php
<!-- put in head tag --> <link rel="shortcut icon" href="<?php echo Yii::app()->request->baseUrl; ?>/favicon.ico" type="image/x-icon" />
Locate your favicon.ico (name of file ico) in your root web directory.
I did it, and you should wthout any problem.
Posted 30 May 2013 - 02:53 PM
1. You can use your own icon file, not have to named as favicon.ico, and not have to in the web site root directory. You have to claim your icon file in your page's head section. In Yii framework, the page head normally in ./protected/views/layouts/main.php
<?php /* @var $this Controller */ ?> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="language" content="en" /> ... <link rel="shortcut icon" href="<?php echo Yii::app()->request->baseUrl; ?>/images/myCompanyLogo.ico" type="image/x-icon" /> <title><?php echo CHtml::encode($this->pageTitle); ?></title> </head>
2. If you are using Windows, you can use "Paint" to create icon file. You may wonder there is no this type when you save as. In a short word, icon file is 16X16 16 color bitmap, or 32X32 256 color bitmap. So the simple way to create your company log icon file is open your company log file in "Paint", resize to 16X16 pixels, then save as 16 color bitmap. Once it saved, changed the file name extension from .bmp to .ico. Done.