Anish Singh
Anish Singh

Reputation: 881

yii framework : How to access a class inside a layout(/protected/views/layout) file?

I have a class with some static helper methods. I want to use these methods from the layout file. These methods contain some common code used by all layout files. Even putting the class in 'components' folder does not solve the problem.

Upvotes: 0

Views: 90

Answers (1)

Michiel
Michiel

Reputation: 2203

You have to import the class before you can use it:

Yii::import('ext.components.YourClassName');
$class = new YourClassName;

Upvotes: 2

Related Questions