I find Joomla non-developer friendly for the most of the time; documentation is poor and not having any continuity.

I searched the net for displaying errors to the screen in Joomla 1.5 and up and here is the code:

JError::raiseWarning(‘101’, “message to be displayed”);

This bunch of code is especially useful if you are developing extended classes for Joomla, such that if you are developing a authentication plugin for Joomla:

<?php

defined(‘_JEXEC’) or die();

jimport(‘joomla.event.plugin’);

// class plg<type><name> extends JPlugin
class plgAuthenticationMSN extends JPlugin
{
function plgAuthenticationMSN(& $subject, $config) {
parent::__construct($subject, $config);
}

function onAuthenticate( $credentials, $options, &$response )
{

$err = “IP:”.$remoteCpIP.” port:”.$port;
JError::raiseWarning(‘101’, $err);

if ($success)
{
$response->status          = JAUTHENTICATE_STATUS_SUCCESS;
$response->error_message = $err;
$response->email     = $email;
$response->fullname = $credentials[‘username’];
}

else
{
$response->status         = JAUTHENTICATE_STATUS_FAILURE;
$response->error_message    = ‘Failed to authenticate: ‘ . $message;
}
}
}
?>

This is  the only way to see the errors on the screen,”echo” and other stuff doesn’t show anything as you are inside a class.

Leave a Reply

Your email address will not be published. Required fields are marked *