CakePHP 3.0: How To Configure Favicon and Get Session Data

You can change favicon from .ico to any extension like .png , .jpg etc…

We are assuming your favicon.png under img directory like YourProjectName/webroot/img/favicon.png

$this->Html->meta('icon', $this->Html->url('/favicon.png'));

To change the default favicon to your own, you may follow below

$this->Html->meta(‘favicon.ico’, ‘/favicon.ico’, [‘type’ => ‘icon’]);

To get user info from any place you can get it using session() method

Suppose you want to get user name of userTable from the session

Either You want to get the title of a PostsTable


Hope this may help

No Comments

Have you say: