Reputation: 747
How can the default fav icon be changed in CakePHP?
Upvotes: 14
Views: 22861
Reputation: 5270
In your webroot folder change cake.icon.png
image instead of your image.
In your view\layouts\default.ctp
just add this code
echo $this->Html->meta('icon');
Upvotes: 1
Reputation: 1
set the following snippet in your layout:
Html->meta('favicon.png','img/favicon.png',array('type' => 'icon')); ?> // favicon.png is your image in webroot/img
Upvotes: -1
Reputation: 29
<?php
echo $this->Html->meta('favicon.ico','/favicon.ico', array('type' => 'icon'));
?>
Upvotes: 0
Reputation: 61
Simply replace the favicon inside app/webroot with your own *.ico favicon. And you're done ! If your favicon won't show after you done as above, Re-refresh your browser Or, simply clear web history.
Upvotes: 3
Reputation: 659
Check your layout.ctp file to check if your favicon is located at the right place.
Put this in your header
<?php echo $this->Html->meta(
'favicon.ico',
'/favicon.ico',
array('type' => 'icon')
);
?>
The size to use is 16x16, png renamed in .ico
Upvotes: 0
Reputation: 52516
Use Html Helper
, put it in <head>
tag:
(File /app/View/Layouts/default.ctp
)
echo $this->Html->meta ( 'favicon.ico', '/favicon.ico', array (
'type' => 'icon'
) );
You also use hyperlink, for example, I used StackOver Flow's favicon:
echo $this->Html->meta ( 'favicon.ico', 'http://cdn.sstatic.net/stackoverflow/img/favicon.ico?v=038622610830', array (
'type' => 'icon'
) );
Of course, You maybe put favicon five in another folder in your web resources folder. For example: put favicon.ico in /app/webroot/img/decor/favicon.ico
:
echo $this->Html->meta ( 'favicon.ico', '/img/decor/favicon.ico', array (
'type' => 'icon'
) );
More information: "favicon.ico" is the convention. Don't chage file name.
Create or choose a favicon: http://www.favicon.cc/ Or see HTML source (Ctrl + U) from another website, and copy & paste.
Work with CakePHP lastest version (2.6.0). Reference: http://book.cakephp.org/2.0/en/core-libraries/helpers/html.html#inserting-well-formatted-elements
Upvotes: 4
Reputation: 45
Replace your favicon with app/webroot/favicon.ico and wait for sometime, as it require some time to reflect on browsers.
Upvotes: 0
Reputation: 5582
you can use this for displaying favicon icon.
<link rel="shortcut icon" type="image/x-icon" href="<?php echo FULL_BASE_PATH; ?>/favicon.ico" />
Upvotes: 0
Reputation: 3492
I had to put the icon into the /img/ folder - it just wouldn't accept it in the root folder.
Upvotes: 0
Reputation: 747
Given like this
<link rel="shortcut icon" type="image/x-icon" href="<?php echo $this->webroot; ?>img/bullet.jpg">
In this way I got the favicon.In that case no need to rename the default favicon.ico
Upvotes: 2
Reputation: 1138
Well you need to delete the default favicon.ico icon file from webroot directory and place your own picture. But make sure you convert that picture in icon format and rename it to favicon. I think it should work because it worked for me.
Upvotes: 0
Reputation: 9964
Simply replace the file app/webroot/favicon.ico
with your own version.
Upvotes: 21