- concrete5 Cookbook
- David Strack
- 141字
- 2021-08-13 16:15:58
Getting a page's description
Page descriptions are not used very widely used in concrete5. Some themes will treat them as content excerpts, while other add-ons will use descriptions as a generic attribute storage area. Regardless, they are still built into concrete5, and in this recipe we will load a page by its path and retrieve its description.
Getting ready
Many pages in concrete5 do not have descriptions. If you wish, you can edit a page to add a description as shown in the following screenshot:

How to do it...
The steps for getting a page's description are as follows:
- Open the
/config/site_post.php
file in your code editor. - Load the page by its path.
$page = Page::getByPath('/about');
- Get the page's description.
$description = $page->getCollectionDescription();
- Dump the contents of the description variable.
my_debug($description);
See also
- The Getting a page by its path recipe
推薦閱讀
- UI圖標創意設計
- Data Visualization with D3 4.x Cookbook(Second Edition)
- Java 開發從入門到精通(第2版)
- PHP+MySQL網站開發項目式教程
- Python機器學習編程與實戰
- Python貝葉斯分析(第2版)
- Kotlin從基礎到實戰
- Web性能實戰
- 深度學習原理與PyTorch實戰(第2版)
- Kubernetes進階實戰
- Struts 2.x權威指南
- 從程序員角度學習數據庫技術(藍橋杯軟件大賽培訓教材-Java方向)
- Learning Ionic(Second Edition)
- Build Your Own PaaS with Docker
- jBPM6 Developer Guide