{"id":20,"date":"2011-04-22T14:09:42","date_gmt":"2011-04-22T14:09:42","guid":{"rendered":"http:\/\/plugged.in\/?p=20"},"modified":"2011-04-22T14:09:42","modified_gmt":"2011-04-22T14:09:42","slug":"joomla-handling-errors","status":"publish","type":"post","link":"https:\/\/www.veriteknik.net.tr\/en\/joomla-handling-errors\/","title":{"rendered":"Joomla &#8211; Handling Errors"},"content":{"rendered":"<p>I find Joomla non-developer friendly for the most of the time; documentation is poor and not having any continuity.<\/p>\n<p>I searched the net for displaying errors to the screen in Joomla 1.5 and up and here is the code:<\/p>\n<p>JError::raiseWarning(&#8216;101&#8217;, &#8220;message to be displayed&#8221;);<\/p>\n<p>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:<\/p>\n<blockquote><p>&lt;?php<\/p>\n<p>defined(&#8216;_JEXEC&#8217;) or die();<\/p>\n<p>jimport(&#8216;joomla.event.plugin&#8217;);<\/p>\n<p>\/\/ class plg&lt;type&gt;&lt;name&gt; extends JPlugin<br \/>\nclass plgAuthenticationMSN extends JPlugin<br \/>\n{<br \/>\nfunction plgAuthenticationMSN(&amp; $subject, $config) {<br \/>\nparent::__construct($subject, $config);<br \/>\n}<\/p>\n<p>function onAuthenticate( $credentials, $options, &amp;$response )<br \/>\n{<\/p>\n<p>$err = &#8220;IP:&#8221;.$remoteCpIP.&#8221; port:&#8221;.$port;<br \/>\nJError::raiseWarning(&#8216;101&#8217;, $err);<\/p>\n<p>if ($success)<br \/>\n{<br \/>\n$response-&gt;status\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 = JAUTHENTICATE_STATUS_SUCCESS;<br \/>\n$response-&gt;error_message = $err;<br \/>\n$response-&gt;email\u00a0\u00a0\u00a0\u00a0 = $email;<br \/>\n$response-&gt;fullname = $credentials[&#8216;username&#8217;];<br \/>\n}<\/p>\n<p>else<br \/>\n{<br \/>\n$response-&gt;status\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 = JAUTHENTICATE_STATUS_FAILURE;<br \/>\n$response-&gt;error_message\u00a0\u00a0\u00a0 = &#8216;Failed to authenticate: &#8216; . $message;<br \/>\n}<br \/>\n}<br \/>\n}<br \/>\n?&gt;<\/p><\/blockquote>\n<p>This is\u00a0 the only way to see the errors on the screen,&#8221;echo&#8221; and other stuff doesn&#8217;t show anything as you are inside a class.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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(&#8216;101&#8217;, &#8220;message to be displayed&#8221;); This bunch of code is especially useful if you are developing [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_uag_custom_page_level_css":"","footnotes":""},"categories":[401],"tags":[400],"yst_prominent_words":[],"class_list":["post-20","post","type-post","status-publish","format-standard","hentry","category-joomla","tag-joomla-2"],"jetpack_featured_media_url":"","uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false},"uagb_author_info":{"display_name":"ckaraca","author_link":"https:\/\/www.veriteknik.net.tr\/en\/author\/ckaraca\/"},"uagb_comment_info":0,"uagb_excerpt":"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(&#8216;101&#8217;, &#8220;message to be displayed&#8221;); This bunch of code is especially useful if you are developing&hellip;","_links":{"self":[{"href":"https:\/\/www.veriteknik.net.tr\/en\/wp-json\/wp\/v2\/posts\/20","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.veriteknik.net.tr\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.veriteknik.net.tr\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.veriteknik.net.tr\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.veriteknik.net.tr\/en\/wp-json\/wp\/v2\/comments?post=20"}],"version-history":[{"count":0,"href":"https:\/\/www.veriteknik.net.tr\/en\/wp-json\/wp\/v2\/posts\/20\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.veriteknik.net.tr\/en\/wp-json\/wp\/v2\/media?parent=20"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.veriteknik.net.tr\/en\/wp-json\/wp\/v2\/categories?post=20"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.veriteknik.net.tr\/en\/wp-json\/wp\/v2\/tags?post=20"},{"taxonomy":"yst_prominent_words","embeddable":true,"href":"https:\/\/www.veriteknik.net.tr\/en\/wp-json\/wp\/v2\/yst_prominent_words?post=20"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}