How can the default fav icon be changed in CakePHP?
Simply replace the file app/webroot/favicon.ico
with your own version.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With