I have a custom component that will be using various AJAX calls, based on outside settings.

How can I load "this" controller from the View or Model to determine if a method/function exists, i.e. PHP method_exists and/or is_callable;

1 Answer 1


I never figured out how to use $this, but it was pretty straightforward otherwise. This checks to see if the add method exists in the Article controller.

$ToolsClass = 'ContentControllerArticle';
$methodToFind = 'add';
JLoader::register($ToolsClass, JPATH_SITE . '/components/com_content/controllers/article.php');
if (!method_exists($ToolsClass, $methodToFind)){
    echo "Content Controller Function '{$methodToFind}' not found";

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.