- concrete5 Cookbook
- David Strack
- 179字
- 2021-08-13 16:15:55
Getting a page type's handle
If a page type has been loaded by its ID or has been provided in a different manner, developers may want to retrieve the handle of the page type. In this example, we will load a page type with an ID of 4
and use the concrete5 API to get its handle.
Getting ready
We will be loading a page type with an ID of 4, so please ensure that this exists in your concrete5 website. Feel free to change the ID in this recipe to something appropriate for your instance of concrete5.
How to do it...
The steps for getting a page type's handle are as follows:
- Open
/config/site_post.php
in your preferred code editor. - Load the page type by its ID.
$pageType = CollectionType::getByID(4);
- Get the handle of the page type.
$handle = $pageType->getCollectionTypeHandle();
- Dump the handle using our custom debugger function.
my_debug($handle);
How it works...
The function getCollectionTypeHandle
of the page type object returns the handle string of the page type.
See also
- The Getting a page type by its ID recipe
推薦閱讀
- Learn TypeScript 3 by Building Web Applications
- Spring Boot開發(fā)與測試實戰(zhàn)
- Java EE 6 企業(yè)級應用開發(fā)教程
- 摩登創(chuàng)客:與智能手機和平板電腦共舞
- 架構不再難(全5冊)
- Mastering phpMyAdmin 3.4 for Effective MySQL Management
- 網(wǎng)頁設計與制作教程(HTML+CSS+JavaScript)(第2版)
- Mastering Unity Shaders and Effects
- 名師講壇:Spring實戰(zhàn)開發(fā)(Redis+SpringDataJPA+SpringMVC+SpringSecurity)
- Regression Analysis with Python
- 深度探索Go語言:對象模型與runtime的原理特性及應用
- Getting Started with Python
- Penetration Testing with the Bash shell
- 數(shù)字媒體技術概論
- Design Patterns and Best Practices in Java