Joomla Search error message lay out
DiceLock Security web site has been set up making use of Joomla. Joomla is a great Content Management System (CMS) that allows us to have a great web site in minutes. But some customizations can be performed to align it with our preferences, like error messages from Search form, and this is one thing we did …
| Applies to: Joomla 1.5 |
These customizations are provided “AS IS” without warranty of any kind and DiceLock Security disclaims all warranties, EITHER EXPRESS OR IMPLIED INCLUDING THOSE OF MERCHANTABILITY, NONINFRINGEMENT OF THIRD-PARTY INTELLECTUAL PROPERTY, OR FITNESS FOR A PARTICULAR PURPOSE.
Upgrading or reinstalling the customized source code (package, plugin, component, …) may remove the customizations performed. |
Joomla offers error or notice messages when the search feature has not found something or it believes that not enough input (input is too short to provide good information) has been introduced in the Search form.
For example if we ask to search for “1“, what we get is:
Indicating that more than 3 characters and a maximum of 20 characters are needed to perform the search.
Or, when a common word like “and” is searched we get:
At DiceLock Security we found it difficult to find out that there was an error, the message was integrated in the default layout and it didn’t notice the viewer that something wrong happened.
We wanted to notice the viewer that something wrong had happened making some changes in the error format. We searched through Joomla directory and we found that Search error messages were handled by the file ROOT/components/com_search/views/search/tmpl/default_error.php.
We found that the default “default_error.php” file looked like:
<?php defined('_JEXEC') or die('Restricted access'); ?> <table class="searchintro<?php echo $this->params->get( 'pageclass_sfx' ); ?>"> <tr> <td colspan="3" > <?php echo $this->escape($this->error); ?> </td> </tr> </table>
So, what we did is to add a “font” tag to show the error message in a llamative colour like red (#FF0000). What we did is to left the file default_error.php like this:
<?php defined('_JEXEC') or die('Restricted access'); ?> <table class="searchintro<?php echo $this->params->get( 'pageclass_sfx' ); ?>"> <tr> <td colspan="3" > <font color="#ff0000"><?php echo $this->escape($this->error); ?></font> </td> </tr> </table>
And now, when our viewers ask to serach for “1“, what they get is:
And when they look for a common word like “and” they get:
The viewers will notice that the search had something wrong that must be fixed.










































