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

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
主站蜘蛛池模板: 方城县| 响水县| 葵青区| 普宁市| 盘锦市| 偏关县| 正安县| 德化县| 客服| 湟源县| 澄江县| 缙云县| 奉化市| 广灵县| 太保市| 南召县| 岳池县| 墨江| 嘉禾县| 申扎县| 常州市| 六枝特区| 崇州市| 仙游县| 铜川市| 阿城市| 卢氏县| 莱州市| 马山县| 元谋县| 禄劝| 扬中市| 邵阳市| 定日县| 昭平县| 静安区| 长汀县| 筠连县| 钟山县| 钟祥市| 江都市|