0

I’m creating a module for a site for the first time and I’m having some trouble figuring out how to get the correct action url for my controller. I’m using this template for setting up the module: https://github.com/doublesecretagency/craft-businesslogic

This is the code in my controller (SendEmailsController.php):

<?php
    namespace modules\businesslogic\controllers;

    use Craft;
    use craft\web\Controller;

    class SendEmailsController extends Controller {
        protected $allowAnonymous = true;

        public function actionTestEmails() {
            echo 'TEST FROM CONTROLLER'; 
        }
    }

I saw this similar question & answer: "Template Not Found" error when trying to access a module controller action which is why I added the /actions/ to the url.

I have tried various iterations for the action url: http://mywebsite.localhost/actions/businesslogic/send-emails/test-emails http://mywebsite.localhost/actions/business-logic/send-emails/test-emails http://mywebsite.localhost/actions/BusinessLogic/send-emails/test-emails http://mywebsite.localhost/actions/modules/businesslogic/send-emails/test-emails

but these all result in a 404 error. I'm not quite sure where I'm going wrong here, so any advice would be appreciated!

Your Answer

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

Browse other questions tagged or ask your own question.