Book Image

Learning Joomla! 1.5 Extension Development

Book Image

Learning Joomla! 1.5 Extension Development

Overview of this book

Table of Contents (17 chapters)
Learning Joomla! 1.5 Extension Development
Credits
About the Author
About the Reviewer
Preface

A simple link plug-in


One of our critics suggested that we should code something that would allow them to link to a review by simply typing in the restaurant's name. For instance, when writing an article about lunch spots, the critic doesn't want to hunt down a link to the Crosstown Deli review. Instead, by just typing Crosstown Deli, he wants it to turn into a link when the article is published. We could modify the code in com_content to do this, but the other critics don't know if they want to commit to this system yet. Also, if com_content is ever patched with updates from the Joomla! core team, we'll have to modify the code again. Instead, we will create a plug-in to search the output for review titles and automatically turn them into links. To do this, create a file named reviews.php in the /plugins/content folder in your Joomla! installation, and add the following code to this new file:

<?php
defined( '_JEXEC' ) or die( 'Restricted access' );
$mainframe->registerEvent( 'onPrepareContent...