Welcome to the Cookbook

loading...
Please login to continue

3.11.2.3 Using your Helper

Once you've created your helper and placed it in /app/views/helpers/, you'll be able to include it in your controllers using the special variable $helpers.

Once your controller has been made aware of this new class, you can use it in your views by accessing a variable named after the helper:

<!-- make a link using the new helper -->
<?php echo $link->makeEdit('Change this Recipe', '/recipes/edit/5') ?>
  1. <!-- make a link using the new helper -->
  2. <?php echo $link->makeEdit('Change this Recipe', '/recipes/edit/5') ?>

The Html, Form and Session (If sessions are enabled) helpers are always available.