- concrete5 Cookbook
- David Strack
- 103字
- 2021-08-13 16:15:58
Getting a page's page type ID
As we discussed earlier in the chapter, pages are assigned a page type. In this recipe, we will get the page type ID from a Page
object.
How to do it...
The steps for getting a page's page type ID are as follows:
- Open
/config/site_post.php
in your code editor, so we can run some arbitrary code. - Load the page by its path.
$page = Page::getByPath('/about');
- Get the page type ID for this page.
$pageTypeId = $page->getCollectionTypeID();
- Dump the page type ID using our custom debugging function.
my_debug($pageTypeId);
See also
- The Getting a page by its path recipe