Joomla – Handling Errors

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:
defined(‘_JEXEC’) or die();
// 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.
  • 3 Users Found This Useful
Was this answer helpful?

Related Articles

How to change storage engine to InnoDB in MySQL?

You’ve designed a database with MyISAM and suddenly realized that you need ACID (atomicity,...

Simple LDAP Class for PHP

In this post, i’m gonna explain how to connect to a LDAP server via using PHP. First i...

Installing IonCube Loader on Linux

Installation of IonCube Loader on any variaty of Linux is very simple.Just get the copy from...

Install JSON Support to PHP on CentOS

Here’s a way to add JSON support for PHP on your CentOS server. yum install php-pear...

PHP : Convert/Replace Short Open Tags

Using short open tags, such as <? on your PHP code is not so clever. Other than the debate...