Seems to be precious little info out there on how templates should be structured. I asked this question earlier but I think I can ask it better with code samples and remove my earlier attempt:
mysite/_config/theme.yml
SilverStripe\View\SSViewer:
themes:
- 'mytheme'
- '$default'
mysite/code/Page.php
<?php
use SilverStripe\CMS\Model\SiteTree;
class Page extends SiteTree {
}
mysite/code/PageController.php
<?php
use SilverStripe\CMS\Controllers\ContentController;
class PageController extends ContentController {
}
mysite/code/pages/HomePage.php
<?php
namespace Vendor\MainSite;
use Page;
class HomePage extends Page {
}
/mysite/code/controllers/HomePageController.php
<?php
namespace Vendor\MainSite;
use PageController;
class HomePageController extends PageController {
}
Then I have my theme. Structure like so:
theme
mytheme
templates
**Page.ss**
Layout
Includes
Vendor
MainSite
Layout
**HomePage.ss**
Assume that Page.ss contains $Layout. The issue I have is Page.ss is never picked up. I have confirmed Silverstripe is loading vendor/silverstripe/framework/templates/SilverStripe/Control/Controller.ss instead. I have tried various locations for Page.ss, including inside the same Vendor directory. I have also moved the entire structure to /mysite/templates.
The only way I have got the above to load a template is by removing namespacing from HomePage.php and simply following the SS3 structure for templates.