Actions
From Aikiframework wiki
Actions are ways to intercept events and do some act.
1) In aiki code you must put
$aiki->plugins->do_action( ACTION, VAR);
- action is literal (unique for each action)
- var is php variable (by reference). No constant is permitted.
Examples:
$aiki->plugins->do_action("output_body_begin", $bodybegin);
$aiki->plugins->do_action("output_head", $header);
2) Document, please, new actions on this page:
3) Recommendations
- Keep a clear and consistent names for action. For example all output action begins with "output".
- we can add so many "action points" that we need. Wordpress, for example have this: http://codex.wordpress.org/Plugin_API/Action_Reference.
|
Output Actions
Rule
A action named like element (favicon,body,head) is called with the entire element as parameters. A action ending with "begin" or "end" is called only with the starting o ending tag of elements. Examples
output favicon : parameter <link rel="icon"... output_head_end: parameter </head> output_head: parameter the entire <head>...</head>
output_begin
Action fired at the very very beginning of the document (before doctype tag). Plugin receives a empty string.
output_head_begin
Action triggered after the setting of the <head> tag. Use it for inserting information at the starting of head tag.
output_doctype
Action fired after doctype and html tag is set.
output_meta
Is fired when aiki generated their meta tag (only encoding and generator). Use it for adding meta (dublin core for example, SEO metas)
output_title
Is called when aiki generated the title tag. The plugin receives the complete tag. Use it for changing the title.
output_favicon
Called when aiki sets favicon (link rel="icon" in html head). You can override this to set a new favicon.
output_head_end
Action triggered after the setting of the </head> tag. Use is for inserting information at the ending of head tag. Note that this action is fired before output_head who need the entire element.
output_head
Is activated after aiki generated the head tag. The plugin receives the complete head. Use it, when you need process the entire head.
output_body_begin
It fired when aiki write the starting body tag. The plugins receives only "<body>". Use it when you want customize body tag adding ids, or class, or want add a initial html element.
output_body_end
it called when aiki write the ending body tag. The plugins receives pnly "</body>". Use it for writing a special footer, o adding final javascrip.
output_body
Action triggered when body element is complete (after output_body_end). Use it, when you want process the entire body.
output_custom
When page is rendered using custom layout (widget_custom_output) or without headers (noheaders) the only action to process content are output_begin, output_custom and output_end
output_end
Called when output has ended. Receive a empty string because, output has no tag.

