The helper class does not produce any output itself, but instead behaves in a way similar to the data models used in our component. Layout files in this module will act the same way as layouts do in component views, containing the actual markup to be output.
The first layout we create will be named _review
. This layout file will do one thing output a fully-formatted anchor tag that uses the name of the review it links to as the link text. With this layout in place, we will be able to construct additional layouts without re-coding the anchor tag display logic.
To create this file, create a tmpl
folder under the existing /modules/mod_reviews
folder, create a new file named _review.php
inside the tmpl
folder, and then add the following lines of code to this new file:
<?php defined('_JEXEC') or die('Restricted access'); ?> <a href="<?php echo $review->link ?>"><?php echo $review->name; ?></a>
The underscore at the beginning of...