Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2013-02-27 14:51:58

MarcoK
Plugin Author
From: Como
Registered: 2006-10-17
Posts: 248
Website

callback_event example

Hi.

i’m making a new plugin and i want use a callback_event function.
At the end of body, into admin side, I need insert some text by different plugin.

At the moment i made this, and it not work. Why?

if(@txpinterface == 'admin') {
  // Insert call of test
  register_callback('mck_test', 'admin_side', 'body_end');
}
 function mck_test($event, $step){
	echo n.'this is a test: my text is:'.
  	'.callback_event('mck_test.show').'; what did you think?'.n;
}

By another plugin I want insert some text:

	if (@txpinterface == 'admin') {
register_callback('mck_insert','mck_test','show');
}
function mck_insert($event, $step){
echo 'This is an Italian Test!!';
}

Someone can help me?

Offline

#2 2013-02-27 15:06:02

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: callback_event example

You are hooking to different event than the one which you are invoking mck_test(). The one you have created is mck_test.show but you are hooking to mck_test > show — latter is defined with a separate event and step. Either put the show to the $step argument in the callback_event(), or merge the $event and $step in register_callback().

Last edited by Gocom (2013-02-27 15:08:26)

Offline

#3 2013-02-27 15:26:25

MarcoK
Plugin Author
From: Como
Registered: 2006-10-17
Posts: 248
Website

Re: callback_event example

Thanks Jukka….. I understand.

Offline

Board footer

Powered by FluxBB