Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to override Joomla System Messages - message.php template

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?

like image 612
Kristian Hildebrandt Avatar asked May 09 '12 20:05

Kristian Hildebrandt


1 Answers

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.

like image 58
Fedik Avatar answered Oct 22 '22 16:10

Fedik