Module Controller does not find Template

Silverstripe Version: 4.1

I had to bring 3 websites together so i made a module for each page to have it separated. Know i have the problem that the controller does not render the template.

This is the file structure:


So i thought this should be the structure for the templates:


Is this correct?

Controller and Model are name spaced. I added the name space to the psr4 autoloader.

I added the getControllerName method to the model so that it finds the controller.

The controller gets called i checked that with xdebug.

Any help would be highly appreciated.

Just in case her is a link to the my code

Your controller is in the namespace R12Proofshop\Controller, so your template should be there as well. It should not be in the Layout folder anymore.

Just to make sure, your Page and PageController are two separate files, right?

sorry for the late response. i was busy the last days. Yes they are. No matter where i put the template it does not get rendered.

Why not use the subsite module?

I have no clue why but this works:


@Greg_808 it works like this - and like expected - , because your R12proofshop\Controller\ProofshopPageController is actually a subclass of PageController which is the controller for a R12proofshop\Model\ProofshopPage.

I know that whole namespacing stuff is pretty new to us both, but thinking about it it might really be handy to leave both, Pages and PageControllers in the Vendor\Module\Pages namespace`? I’m still not sure about how to proper namespace my code…