6

Joomla by default renders its system messages (errors, notices etc.) in

libraries/joomla/document/html/renderer/message.php.

For my own template, I would like to customize the way these messages are displayed. However it does not seem to be possible in the traditional way, using template overrides.

Is anyone here aware of a way to accomplish something like this?

Valentin Despa
  • 40,712
  • 18
  • 80
  • 106
Kristian Hildebrandt
  • 1,528
  • 1
  • 14
  • 16

4 Answers4

20

For Joomla! 1.7 - 2.5

You need copy libraries/joomla/document/html/renderer/message.php in to templates/YOUR_TEMPLATE/html/message.php

Then in index.php of YOUR_TEMPLATE you need to include the file (as it is not automatically included like other overrides):

// Message overwrite
require_once JPATH_ROOT .'/templates/'. $this->template .'/html/message.php';

Now you can safety overwrite the JDocumentRendererMessage::render() function there ;)

For Joomla! 3.x

You just need make html/message.php file in YOUR_TEMPLATE. This file should contain function renderMessage(). Check the isis default template, as example.

Valentin Despa
  • 40,712
  • 18
  • 80
  • 106
Fedik
  • 468
  • 7
  • 22
0

Templates overrides only work with the MVC - i.e. views and module chrome.

Without hacking the core all you can do is control what HTML tags are wrapped around the <jdoc:include type="message" /> tag in the template and the CSS defined for the elements of the message block.

Craig
  • 9,335
  • 2
  • 34
  • 38
0

A more elegant way to include your override in the template directory is to include the file in a system plugin:

public function onAfterInitialise() {
    $app = JFactory::getApplication();
    if ($app->isSite()) {
        $template = $app->getTemplate();
        if (!class_exists('JDocumentRendererMessage') && file_exists(JPATH_THEMES . '/' . $template . '/html/message.php')) {
            require_once JPATH_THEMES . '/' . $template . '/html/message.php';
        }
    }
    return true;
}
Mallesbixie
  • 180
  • 1
  • 7
  • No it's not. If one just means to override the template, just place the appropriate files where they're supposed to be... no need to code plugins to do what is already part of the MVC. – Alexandre Paulo Apr 01 '15 at 18:08
0

http://extensions.joomla.org/extensions/style-a-design/popups-a-iframes/26551

OR

http://extensions.panchsoft.com/product/1-popup-system-messages.html

Use this extension for default messages for Joomla.