Hey, I have a PersonHolder.php with a template PersonHolder.ss which has PersonPage.php as allowed_children. The PersonHolder.ss loops through the persons and displays them. The PersonPage.php can’t be root, I don’t want it to be visited as separate url so I don’t have any need for a PersonPage.ss file and I didn’t create it under Layout. So there is no PersonPage.ss.
Now when I visit a PersonPage directly with a url (I can see in backend), I can still access the PersonPage seperate what only displays the Title of the page, because there is no template.
Is there a way to redirect to 404 when a page template doesn’t exists?
It sounds like your Person class should extend from DataObject instead of Page. You can then create a has_many relationship from PersonHolder to Person and create and manage People on your PersonHolder pages with a GridField. You can then loop through a DataList of those people in your PersonHolder.ss template.
[2019-03-08 10:40:30] error-log.ERROR: Uncaught Exception BadMethodCallException: “Object->__call(): the method ‘scaffoldSearchField’ does not exist on ‘SilverStripe\Assets\Image’” at /html/vendor/silverstripe/framework/src/Core/CustomMethods.php line 54 {“exception”:“[object] (BadMethodCallException(code: 0): Object->__call(): the method ‘scaffoldSearchField’ does not exist on ‘SilverStripe\Assets\Image’ at /html/vendor/silverstripe/framework/src/Core/CustomMethods.php:54)”}
Update:
I found this issue and fixed it by using Photo.Title.
Glad you fixed it! If your question is solved you can mark it as such by ticking the checkbox on a reply. That lets other forum members know you don’t need help with this issue anymore.