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

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
主站蜘蛛池模板: 武夷山市| 砚山县| 靖安县| 蕲春县| 诸暨市| 孙吴县| 邵武市| 涞源县| 长顺县| 邵东县| 平顺县| 尼勒克县| 邵阳市| 都江堰市| 陆河县| 太原市| 固始县| 休宁县| 曲水县| 阜阳市| 嘉义市| 竹山县| 长沙县| 琼结县| 上思县| 林周县| 呈贡县| 安顺市| 高雄县| 凤翔县| 武定县| 贵定县| 鄢陵县| 马山县| 浪卡子县| 称多县| 马公市| 肇庆市| 德兴市| 勐海县| 那坡县|