$page->changeTemplate()
Changes the page template
Parameters
Name | Type | Default |
---|---|---|
$template * | string |
– |
Return type
This method does not modify the existing $page
object but returns a new object with the changes applied. Learn more →
Exceptions
Type | Description |
---|---|
Kirby\Exception\LogicException |
If the textfile cannot be renamed/moved |
Parent class
Details
Changing the page template can lead to unwanted data loss. Always make sure you have a backup of your data before using this method.
Kirby's objects are immutable. That means, when you modify an object like $page
, $file
etc. using a method like update()
, changeTitle()
and so on, a new object is returned. Therefore, you have to store the returned object in a new variable to be able to further work with it.