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

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
主站蜘蛛池模板: 五大连池市| 乌恰县| 隆昌县| 鄂伦春自治旗| 盐源县| 府谷县| 康定县| 昌图县| 大竹县| 陵川县| 广河县| 铁岭县| 章丘市| 武乡县| 浙江省| 湟中县| 淄博市| 芦山县| 镇远县| 开阳县| 马龙县| 巧家县| 成都市| 和政县| 界首市| 旌德县| 敦化市| 武城县| 台山市| 德阳市| 肥城市| 屏山县| 比如县| 河池市| 海口市| 邛崃市| 防城港市| 辉县市| 兴安盟| 鄂伦春自治旗| 苏尼特左旗|