Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-01-17 21:21:46

leafy_loader
Member
Registered: 2008-09-25
Posts: 96

Output message to "messagepane"

I’m developing a simple plugin and wondered if there was a function available that outputs a message in the “messagepane” cell?

Offline

#2 2011-01-17 21:40:17

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: Output message to "messagepane"

On what page? The message gets to the page via the pagetop() function.


Code is topiary

Offline

#3 2011-01-17 21:55:13

leafy_loader
Member
Registered: 2008-09-25
Posts: 96

Re: Output message to "messagepane"

It’s the table cell top left of every page, labelled id=“messagepane”, that displays confirmation, error messages etc.

Offline

#4 2011-01-17 22:07:55

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: Output message to "messagepane"

Right, on which page do you want the message to appear?


Code is topiary

Offline

#5 2011-01-17 22:11:24

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

Re: Output message to "messagepane"

As Jeff said, pagetop() is the answer. The pagetop() outputs the full header, including navigation links and message pane.

The function takes two arguments; title and message: pagetop( title, message ). In the function you are calling on your event you would do something like:

pagetop(
	'My Page Title',
	'My message'
);

If it’s already existing page, then it all depends from the page you are trying to place the message to.

Last edited by Gocom (2011-01-17 22:15:48)

Offline

#6 2011-01-17 22:14:49

leafy_loader
Member
Registered: 2008-09-25
Posts: 96

Re: Output message to "messagepane"

Oh I see. Thanks.

Does the pagetop function have to appear first in the order of statements within my function? The message I want to output is generated after a conditional is run within the same satement

Offline

#7 2011-01-17 22:17:52

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

Re: Output message to "messagepane"

leafy_loader wrote:

Does the pagetop function have to appear first in the order of statements within my function? The message I want to output is generated after a conditional is run within the same satement

Pagetop uses echo, so yes. It has to be placed before other echos. You can use variables to store the later echos or something similiar. I persoanally use arrays and implode it at the end of the function.

For example:

function xxx_my_pane($msg='') {
	if('dog' == 'cat') {
		$msg = 'Do did';
	}
	$out[] = 'something';
	pagetop('Title',$msg);
	echo implode('',$out);
}

Last edited by Gocom (2011-01-17 22:20:36)

Offline

Board footer

Powered by FluxBB