sreenavc
sreenavc

Reputation: 747

CakePHP fav icon

How can the default fav icon be changed in CakePHP?

Upvotes: 14

Views: 22861

Answers (12)

A.A Noman
A.A Noman

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

Khalid BELFARHOUNIA
Khalid BELFARHOUNIA

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

User
User

Reputation: 29

<?php 
    echo $this->Html->meta('favicon.ico','/favicon.ico', array('type' => 'icon'));     
?>

Upvotes: 0

Paul LeJoy
Paul LeJoy

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

Romain
Romain

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

Vy Do
Vy Do

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

Hitesh Chopra
Hitesh Chopra

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

Lakhwinder Singh
Lakhwinder Singh

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

Rusty Divine
Rusty Divine

Reputation: 3492

I had to put the icon into the /img/ folder - it just wouldn't accept it in the root folder.

Upvotes: 0

sreenavc
sreenavc

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

Keyur Padalia
Keyur Padalia

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

dhofstet
dhofstet

Reputation: 9964

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

Upvotes: 21

Related Questions