Tuesday, August 4, 2009

Custom Helper not loaded

Hi there,

I just wrote my first helper and, sure enough, ran into some problems.
For some reason my helper is not being loaded. As I could not find
anything similar I just expect something to be done wrong in my code.

My Helper (/app/views/helpers/content.php):
<?php
class ContentHelper extends AppHelper{
function get($id){
$t = $this->requestAction('texts/get/'.$id);
return $this->output($t);
}
}
?>

I placed it like this into $helpers in my app_controller (/app/
app_controller.php):
var $helpers = array('Content');

And finally in my Controller (/app/controllers/about_controller.php) I
use it like this:
function index(){
$this->set("text", $content->get('about_team'));
}

However, no matter how I twist and turn it (putting it into the
Controllers $helper, writing it differently) I always get the same
error-message:
Undefined variable: content [APP/controllers/about_controller.php,
line 7]

During this process I learned that I do not get any error-messages
about my Helper-File at all. I've put an PHP-Error (deleting the
last }) into it without complaints. Heck, I can write whatever I want
into $helper and do not get any errors. It seems like to me that my
Helper is never loaded, $helper never parsed for any custom helpers.

Does anybody have a clue what I might be doing wrong?

My Cake-Version is 1.2.3.8166.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: