- 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
推薦閱讀
- VMware View Security Essentials
- 自制編譯器
- OpenCV實例精解
- SSM輕量級框架應(yīng)用實戰(zhàn)
- The DevOps 2.5 Toolkit
- BIM概論及Revit精講
- Windows Phone 7.5:Building Location-aware Applications
- Web Developer's Reference Guide
- Python自然語言理解:自然語言理解系統(tǒng)開發(fā)與應(yīng)用實戰(zhàn)
- Scratch從入門到精通
- 官方 Scratch 3.0 編程趣味卡:讓孩子們愛上編程(全彩)
- Clojure High Performance Programming(Second Edition)
- Visual Basic語言程序設(shè)計上機指導與練習(第3版)
- Mastering Machine Learning with scikit-learn
- Kotlin入門與實戰(zhàn)