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

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
主站蜘蛛池模板: 阜平县| 浪卡子县| 莱西市| 璧山县| 汕尾市| 河池市| 河池市| 诸暨市| 乌海市| 孟连| 广河县| 胶州市| 特克斯县| 钟祥市| 龙江县| 怀集县| 多伦县| 合川市| 哈巴河县| 明光市| 民乐县| 金湖县| 镇巴县| 卫辉市| 武宣县| 靖边县| 金秀| 白山市| 石狮市| 冷水江市| 义乌市| 诏安县| 大田县| 洪湖市| 枣阳市| 南城县| 无锡市| 安图县| 中西区| 德钦县| 洞口县|