Im upgrading our solution to Sage 10, we previously had controllers etc and used template files. In the new solution I can select the template in the CMS, this changes the ACF fields that are available. However when I view the page it isn’t using the template file, it is just trying to generate the page.blade.php. Ive tried creating composer files for TemplateHomepage and gone through everything I can find online but I just cant get it to render the template which is selected in the CMS
for ref Im using template-home.blade.php which extends single (and subsequently app).
When moving to a Sage theme you likely changed the file path for the template.
I think this is used as the key for the selection on the page of which template to use (not the name as you would expect)
So you may have to go through each page and reselect the template used.
Currently, the fields from ACF are pulling through to the editor (Im using ACF Composer and setting the location in there for the field set), so that’s all good. But previously I would just then create a template-homepage.blade.php for example and if that’s the template selected for the page, then that’s what was rendered.
Im sure Im just missing something simple.
Ah, it looks like there was something in the previous code which mapped selected templates to the alternate temaplte names. So we wodul have a view called template-homepage.blade.php, in the meta it would say the template name was Homepage (which is what would show in the CMS dropdown. The AF fields were connected directly to the filename so that all worked.
What I needed to do was rename the file to remove the 'template- ’ part and it all clicks in correctly once I also set the template in the views array. Ill need to try and dig out where it was previous mapping that over to double check it wasn’t doing anything else