官术网_书友最值得收藏!

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:

  1. Open /config/site_post.php in your preferred code editor.
  2. Load the page type by its ID.
    $pageType = CollectionType::getByID(4);
  3. Get the handle of the page type.
    $handle = $pageType->getCollectionTypeHandle();
  4. 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
主站蜘蛛池模板: 保康县| 婺源县| 出国| 钦州市| 惠东县| 寿宁县| 长武县| 滕州市| 英超| 达州市| 莱州市| 大兴区| 惠州市| 三河市| 灵宝市| 乃东县| 长海县| 沁水县| 长宁县| 本溪| 高要市| 景德镇市| 香格里拉县| 武陟县| 县级市| 咸宁市| 洛南县| 佛教| 东台市| 盐亭县| 华坪县| 鸡西市| 涡阳县| 友谊县| 沧源| 凤山市| 囊谦县| 志丹县| 沁源县| 扎赉特旗| 汉川市|