3.11.2.1 Including other Helpers
You may wish to use some functionality already existing in another helper. To do so, you can specify helpers you wish to use with a $helpers array, formatted just as you would in a controller.
<?php
/* /app/views/helpers/link.php (using other helpers) */
class LinkHelper extends AppHelper {
var $helpers = array('Html');
function makeEdit($title, $url) {
// Use the HTML helper to output
// formatted data:
$link = $this->Html->link($title, $url, array('class' => 'edit'));
return $this->output("<div class=\"editOuter\">$link</div>");
}
}
?>
<?php/* /app/views/helpers/link.php (using other helpers) */class LinkHelper extends AppHelper {var $helpers = array('Html');function makeEdit($title, $url) {// Use the HTML helper to output// formatted data:$link = $this->Html->link($title, $url, array('class' => 'edit'));return $this->output("<div class=\"editOuter\">$link</div>");}}?>


























