Ok just starting out with Yii but getting frustrated already since I can’t get my favicon to show up. Can someone point me in the right direction please?
Ok just starting out with Yii but getting frustrated already since I can’t get my favicon to show up. Can someone point me in the right direction please?
Set it in views/layouts/main.php
Sorry should have included that. I am using that file.
More info.
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.
In main.php file in layouts, you can use meta tag to set the favicon location
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.
I just read this post it worked!
Thank you very much sir!
Summary favicon.ico issue.
<?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>
Great! Thank you!
Got the same problem. Above solutions helped. Thanks.
@Johnny Gan it’s work for me. Thank you so much sir.