The Joomla! Forum ™



Forum rules


Please use the mailing list here: http://groups.google.com/group/joomla-dev-general rather than this forum.



Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Wed Jan 05, 2011 6:01 pm 
User avatar
Joomla! Ace
Joomla! Ace

Joined: Sat Feb 11, 2006 8:32 am
Posts: 1155
Location: Tilburg, Holland
all of these 1.5 methods for setting a message don't seem to work on 1.6:
http://docs.joomla.org/Display_error_me ... nd_notices
http://docs.joomla.org/JError

I want to set a warning message like:
Code:
JError::raiseWarning(500, JText::_('COM_BANNERS_NO_BANNERS_SELECTED'));


how to do this in 1.6?

_________________
http://www.pages-and-items.com
Admin-Help-Pages, Dynamic-Menu-Links, Admin-Menu-Manager, Access-Manager, Redirect-on-Login, Pages-and-Items, module Admin-Messages, module Logged-in-Users, plugin load module in article, plugin pure css tooltip and more...


Top
 Profile  
 
PostPosted: Thu Jan 06, 2011 8:00 am 
User avatar
Joomla! Explorer
Joomla! Explorer

Joined: Sun Dec 13, 2009 9:00 pm
Posts: 374
Location: Switzerland
JError::raiseWarning(500, JText::_('YOUR_STRING'));

still works. I just tested it in my component. It shows me the red message bar as expected.
You're sure your template supports showing the messages?


Top
 Profile  
 
PostPosted: Thu Jan 06, 2011 8:11 am 
User avatar
Joomla! Ace
Joomla! Ace

Joined: Sat Feb 11, 2006 8:32 am
Posts: 1155
Location: Tilburg, Holland
Quote:
You're sure your template supports showing the messages?

yes, joomla's default ruck milkyway.

I added the above code in the php of the template. no message.

In the backend in some view-template it works fine.

_________________
http://www.pages-and-items.com
Admin-Help-Pages, Dynamic-Menu-Links, Admin-Menu-Manager, Access-Manager, Redirect-on-Login, Pages-and-Items, module Admin-Messages, module Logged-in-Users, plugin load module in article, plugin pure css tooltip and more...


Top
 Profile  
 
PostPosted: Thu Jan 06, 2011 9:15 am 
User avatar
Joomla! Explorer
Joomla! Explorer

Joined: Sun Dec 13, 2009 9:00 pm
Posts: 374
Location: Switzerland
I tested it in the view class (view.html.php) like this:

Code:
<?php
defined('_JEXEC') or die('Restricted access');

jimport( 'joomla.application.component.view');


class MycomponentViewMyview extends JView
{
   function display($tpl = null)
   {
JError::raiseWarning(500, JText::_('YOUR_STRING'));
...
more view specific code
...
}


also using rhuk_milkway for my tests.


Top
 Profile  
 
PostPosted: Thu Jan 06, 2011 12:50 pm 
User avatar
Joomla! Ace
Joomla! Ace

Joined: Sat Feb 11, 2006 8:32 am
Posts: 1155
Location: Tilburg, Holland
I confirm that it works in the view-class and in the views template, but not from within the actual template index.php (ruck milkyway).

I would actually like to use it from the 'onAfterRender' event in a system plugin. Just thinking about this, obviously the content is aalready rendered so the message code can not be added to the output anymore. I will test with different events.
OK! got it working with the 'onAfterInitialise' event. Great! just what I needed.

solved (sort of).

_________________
http://www.pages-and-items.com
Admin-Help-Pages, Dynamic-Menu-Links, Admin-Menu-Manager, Access-Manager, Redirect-on-Login, Pages-and-Items, module Admin-Messages, module Logged-in-Users, plugin load module in article, plugin pure css tooltip and more...


Top
 Profile  
 
PostPosted: Fri Jan 07, 2011 1:38 pm 
User avatar
Joomla! Ace
Joomla! Ace

Joined: Sat Feb 11, 2006 8:32 am
Posts: 1155
Location: Tilburg, Holland
mwaa!
turns out that it does not work when a user logs out.

in system plugin:
Code:
function onAfterInitialise(){
      JError::raiseNotice('SOME_ERROR_CODE', 'chickensoup');
   }


the above code will display the message on each page, but when a user logs out, the Joomla 404 page is shown with the error (white page with big red block). Not just the page after logging out with the message (as I want it).

Also when logging in, the message is shown twice.

Feels quite buggy this.

I just want to display a message after a user logs out.

_________________
http://www.pages-and-items.com
Admin-Help-Pages, Dynamic-Menu-Links, Admin-Menu-Manager, Access-Manager, Redirect-on-Login, Pages-and-Items, module Admin-Messages, module Logged-in-Users, plugin load module in article, plugin pure css tooltip and more...


Top
 Profile  
 
PostPosted: Wed Jun 15, 2011 6:04 pm 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Tue Jun 15, 2010 1:12 am
Posts: 246
Location: United Kingdom, London
Thanks i had a problem were my components had errors to display to users for example (Field required)

But i was missing this bit of code from my custom template

Code:
<jdoc:include type="message" />


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 



Who is online

Users browsing this forum: No registered users and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group