Difference between revisions of "JEvent"
From Joomla! Documentation
(New page: <span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>Edit Descripton<nowiki>]</nowiki>
</span>
{{Description:JEvent}}
===Defined in===
librari...) |
m (added Category:Archived pages API15 using HotCat) |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 18: | Line 18: | ||
|Method to trigger events | |Method to trigger events | ||
|} | |} | ||
+ | |||
===Importing=== | ===Importing=== | ||
<source lang="php">jimport( 'joomla.event.event' );</source> | <source lang="php">jimport( 'joomla.event.event' );</source> | ||
Line 30: | Line 31: | ||
<dpl> | <dpl> | ||
noresultsheader=\n | noresultsheader=\n | ||
+ | namespace=CodeExample | ||
category=JEvent | category=JEvent | ||
category=CodeExample | category=CodeExample | ||
Line 35: | Line 37: | ||
include=* | include=* | ||
format= ,,, | format= ,,, | ||
+ | reset=categories | ||
</dpl> | </dpl> | ||
+ | |||
+ | [[Category:Archived pages API15]] |
Revision as of 21:26, 4 July 2013
The "API15" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.
[Edit Descripton] Template:Description:JEvent
Defined in[edit]
libraries/joomla/event/event.php
Methods[edit]
Method name | Description |
---|---|
JEvent | Constructor |
update | Method to trigger events |
Importing[edit]
jimport( 'joomla.event.event' );
[Edit See Also] Template:SeeAlso:JEvent
Examples[edit]
<CodeExamplesForm />
Let's think of an event, that could affect different parts of your application... To keep it simple, we say that we create an onEmailChange event, that is triggered once the user changes his email address. When he does that, we want to display the change to the screen, but we also want to store it to the database. We also know, that there might be some components out there, who would like to implement their own functionality, once the useer changes his email-address.
After the Event Handlers have been created and added to the dispatcher, the event can be triggered from anywhere in the application. This could be in another module, another component, within the framework or even in another plugin.
Other components can now create their own concrete Event Handlers for the onEmailChange event and register it to the dispatcher. They will automatically be triggered once the event occurs anywhere in the application.
This example was originally contributed by User:Batch1211.