Recent Topics

1 Feb 10, 2008 15:47    

How doI display some debug info in the widget settings screen when some condition is not met.
It's an if statement that catches a potential error. I now have

echo( 'setting not correct' ;)


or similar, but I want a nice box.
I am looking for a red bordered div. I cannot find anything like debug_output or the like.
And how do I display in the Widget settings of the current widget and not on the blog itself -like the echo does-?

Tx

2 Feb 10, 2008 15:54

Your questions a tad confusing.

If you wish to add something to the debug log within your plugin you would use something like :

<?php
global $Debug;
$Debuglog->add( 'your message', 'your plugin name' );
?>

If you wish to add an error message to the screen you would use something like :

<?php
$this->msg( 'your error message', 'error' );
?>

Similarly, if you wish to add an ok message to the screen :

<?php
$this->msg( 'your ok message', 'success' );
?>

Source : inc/plugins/_plugin.class.php approx 2493

	/**
	 * A simple wrapper around the {@link $Messages} object with a default
	 * catgory of 'note'.
	 *
	 * @param string Message
	 * @param string|array category ('note', 'error', 'success'; default: 'note')
	 */
	function msg( $msg, $category = 'note' )
	{
		global $Messages;
		$Messages->add( $msg, $category );
	}

¥

3 Feb 10, 2008 16:10

Hi ¥åßßå,

Must be confusing indeed. I needed the msg thing. I only saw the boxes in the code for debug mode. That's why I looked in that direction. But WOW again. Simply msg().
I have a comma separated list in the settings and users may enter wrong values or less or more items than they should and I want to provide a neat explanation why nothing happens in their views.
These boxes appear in the blog though and not in the setting, but that's fine, since hitting the OK button brings them back to the blog.

A big thanks

--F


Form is loading...