- 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
推薦閱讀
- Vue.js 3.x快速入門(mén)
- Photoshop智能手機(jī)APP UI設(shè)計(jì)之道
- Maven Build Customization
- Web Scraping with Python
- iOS開(kāi)發(fā)實(shí)戰(zhàn):從零基礎(chǔ)到App Store上架
- Python Game Programming By Example
- 羅克韋爾ControlLogix系統(tǒng)應(yīng)用技術(shù)
- Building a Quadcopter with Arduino
- 自然語(yǔ)言處理Python進(jìn)階
- Tableau 10 Bootcamp
- 智能手機(jī)故障檢測(cè)與維修從入門(mén)到精通
- 硬件產(chǎn)品設(shè)計(jì)與開(kāi)發(fā):從原型到交付
- 交互式程序設(shè)計(jì)(第2版)
- RESTful Web API Design with Node.js(Second Edition)
- 絕密原型檔案:看看專(zhuān)業(yè)產(chǎn)品經(jīng)理的原型是什么樣