O'Reilly logo

Learning Joomla! 1.5 Extension Development by Joseph L. LeBlanc

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Searching the reviews

Some of our visitors have complained that they cannot find restaurant reviews through the search form. We can fix this by writing a search plug-in to scan the reviews along with the results for content. Create a file name/plugins/search/reviews.php, and add the following code to it:

<?php
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport( 'joomla.plugin.plugin' );
class plgSearchReviews extends JPlugin
{

In contrast to our content plug-in, for the search plug-in we are extending the JPlugin class instead of calling the registerEvent() member function of the mainframe object. This is a newer method of constructing plug-ins, that is becoming the preferred method.

To start using this style, jimport('joomla.plugin.plugin') ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required