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

Getting a page's page type ID

As we discussed earlier in the chapter, pages are assigned a page type. In this recipe, we will get the page type ID from a Page object.

How to do it...

The steps for getting a page's page type ID are as follows:

  1. Open /config/site_post.php in your code editor, so we can run some arbitrary code.
  2. Load the page by its path.
    $page = Page::getByPath('/about');
  3. Get the page type ID for this page.
    $pageTypeId = $page->getCollectionTypeID();
  4. Dump the page type ID using our custom debugging function.
    my_debug($pageTypeId);

See also

  • The Getting a page by its path recipe
主站蜘蛛池模板: 阳高县| 天镇县| 左云县| 长垣县| 高清| 玛曲县| 宁都县| 利川市| 宜昌市| 贵德县| 建瓯市| 特克斯县| 乐清市| 芒康县| 西藏| 阳东县| 平邑县| 临泉县| 和平区| 中西区| 西畴县| 上饶县| 巴马| 济宁市| 巢湖市| 全州县| 新沂市| 喜德县| 高碑店市| 梨树县| 五大连池市| 潞西市| 唐山市| 晋城| 太谷县| 通道| 龙岩市| 报价| 尼木县| 陇川县| 聂拉木县|