I am moving some code from a site into a module.
I have the following in my Page_controller on Page.php working.
class Page_Controller extends ContentController {
function RandomText($num=1) {
return DataObject::get("TextResource", "", "RAND()", "", $num);
}
}
But when try to move the class in many ways to a module SS can't seem to find it.
in seperate file(module/code/Randomtext_Controller.php) I have:
<?php
class RandomText_Controller extends Page_Controller {
function RandomText($num=1) {
return DataObject::get("TextResource", "", "RAND()", "", $num);
}
}
and tried various things like:
Object::add_extension('Page_Controller', 'RandomText_controller');
in the modules _config.php
Any ideas thanks in advance.