I'm trying to create a plugin with a controller, but I don't want to render any view but run a script from a cronjob. I can't get into the controller with an url and I'm not sure why.

I already tried everything here but it does not state any way to directly call a controller with an url. Is this possible?

2 Answers 2


As that page in the docs says, dedicated controller action URLs will look like:


If your plugin’s name is “CocktailRecipes”, and you have a controller located at plugins/cocktailrecipes/controllers/CocktailRecipesController.php, and within that you have a function called actionSaveIngredient(), you would get to that via:


If your controller is actually called CocktailRecipes_IngredientsController.php, it would be this instead:


Your plugin can also register a route (either CP-facing or site-facing) which could provide a cleaner endpoint for the controller:

public function registerSiteRoutes()
    return array(
        'saveIngredient' => array('action' => 'cocktailRecipes/ingredients/saveIngredient'),

If you had that in place, you’d be able to access CocktailRecipes_IngredientsController’s actionSaveIngredients() like this instead:


Note: I don’t recommend trying to create a route for your controller until you’ve figured out how to get a basic action URL to point to it correctly. No need to add another step of complexity while you’re still troubleshooting.


The docs explain how to generate links to controller actions. Assuming your action trigger is "actions" (as it is by default) then your URL will look as follows:


Following the first example in the docs, the URL will look as follows:


Be sure to allow anonymous access to your controller action so it can be reached by the cron job.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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