- concrete5 Cookbook
- David Strack
- 85字
- 2021-08-13 16:15:58
Getting a page's name
Page names are often used as the de facto titles in concrete5. In this exercise, we will load a page by its path, and then get its name.
How to do it...
The steps for getting a page's name are as follows:
- Open
/config/site_post.php
in your editor. - Load the page by its path.
$page = Page::getByPath('/about');
- Get the page's title.
$name = $page->getCollectionName();
- Dump the contents of the title variable.
my_debug($name);
See also
- The Getting a page by its path recipe