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:
![33](https://forum.silverstripe.org/uploads/default/original/1X/18ba3c928c3ce4609fed69c3a1a33714614783e9.png)
So i thought this should be the structure for the templates:
![19](https://forum.silverstripe.org/uploads/default/original/1X/e5b1e2e6dc07e2d1a41cb0294beb95f7dc4386c0.png)
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 https://gist.github.com/Greg808/f7713934bb63120d54046e6289d00e35
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:
![11](https://forum.silverstripe.org/uploads/default/original/1X/4d103c8710abb27a1263519165b4f3ee757ac80e.png)
@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…
2 Likes