0

I am a newbie in yii and i want to know whether is there any method which can set a value of a variable whenever any page loads. Eg-(Its just an example) if there is a variable $count . Now i want to set the value of the $count as 3 whenever any page loads . I have heard about onBeginRequest() but do not know how to do it. ANy help will be appreciated

Let me see
  • 5,063
  • 9
  • 34
  • 47

1 Answers1

1

In the application life cycle, onBeginRequest is raised right BEFORE the application processes the request. So you can do anything you want before your pages are loaded.

See this link if you want to know how to use onBeginRequest How to use events in Yii

Community
  • 1
  • 1
secretlm
  • 2,361
  • 2
  • 27
  • 38