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

Getting a page's path

In addition to being able to get a page's ID, developers can also retrieve the path for a page. In this recipe, we will load a page by its ID and then retrieve its path.

How to do it...

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

  1. Open /config/site_post.php in your preferred code editor.
  2. Load the page by its ID. We will use the ID of 4 here, which should belong to a page on the dashboard.
    $page = Page::getByID(4);
  3. Get the page's path.
    $path = $page->getCollectionPath();
  4. Use the custom debugging function to output the path.
    my_debug($path);

See also

  • The Getting a page by its ID recipe
主站蜘蛛池模板: 兴国县| 开化县| 金门县| 长沙市| 磐安县| 景宁| 三台县| 克山县| 宁明县| 科技| 黄冈市| 历史| 滁州市| 库尔勒市| 石门县| 海原县| 南溪县| 格尔木市| 凤城市| 永顺县| 万安县| 滨州市| 来凤县| 廉江市| 濮阳县| 夹江县| 蒙阴县| 社旗县| 新乡县| 额尔古纳市| 兰西县| 吴桥县| 措勤县| 南岸区| 红安县| 陵川县| 昂仁县| 胶南市| 稷山县| 寻甸| 鹤庆县|