Reputation: 1643
I am upgrading a 3.x site to 4.x. All seemingly going fine and this morning I could actually load my site after upgrading the core framework and other modules.
I have just been through the Upgrading process found here and completed the part where I namespace all custom files in /mysite. Which I have done, with the exception of Page.php and PageController.php.
The issue I am having is since doing this namespacing, no page can find any template in the system. All pages use /framework/templates/SilverStripe/Control/Controller.ss (confirmed by markup in the source).
There is some very brief discussion in the upgrade doc that goes into templates, but very little. And I've spent the day trying to find tutorials on what the docs might mean by the incomplete statement:
Core template locations have moved - if you’re including or overriding these (e.g. for FormField templates) please adjust to the new paths.
(It's incomplete because it doesn't go on to say what "new paths" actually are.)
If you have a file /mysite/code/Page.php (with no namespace), would you expect the template in /mysite/template/Page.ss to load? In my case, it doesn't. If you had another page called HomePage that extended Page.php, but had the namespace Vendor\MySection, where would you expect to find the template in the file system?
Edit: Example of what is not working:
I have tried the following structure in both my /themes/[themename]/templates directory and /mysite/templates directory:
Page.ss
Vendor
MyProject
Layouts
HomePage.ss
In either case, neither the Page.ss template, or the HomePage.ss template is picked up. The page is presented by Controller.ss.
The only way I have got this to work is by removing namespacing from ALL pages and following the structure normally found in SS3.
Edit 2: Just the contents of my config.yml
SilverStripe\View\SSViewer:
themes:
- 'mytheme'
- '$default'
Upvotes: 2
Views: 626
Reputation: 4626
The templates should also be "namespaced";
The template dir in my latest SS4 project looks like
templates
TBH the first try was a lot of WTF and trial and error
Upvotes: 2