Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CakePHP fav icon

How can the default fav icon be changed in CakePHP?

like image 626
sreenavc Avatar asked Dec 27 '10 06:12

sreenavc


2 Answers

Simply replace the file app/webroot/favicon.ico with your own version.

like image 129
dhofstet Avatar answered Oct 18 '22 08:10

dhofstet


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

like image 28
Do Nhu Vy Avatar answered Oct 18 '22 09:10

Do Nhu Vy