- concrete5 Cookbook
- David Strack
- 137字
- 2021-08-13 16:15:57
Getting a page's ID
Developers will often need to know a page's ID, especially when relating pages to other database objects (such as a blog post or calendar event). In this example, we will load the /about
page that we've been working with and get its ID.
Getting ready
Please make sure the /about
page exists in your instance of concrete5. Feel free to modify the code in this recipe if that page does not exist.
How to do it...
The steps for getting a page's ID are as follows:
- Open
/config/site_post.php
in your code editor. - Load the
Page
object by its path.$page = Page::getByPath('/about');
- Get the page's ID.
$id = $page->getCollectionId();
- Dump the contents of the
$id
variable to see what the ID is.my_debug($id);
See also
- The Getting a page by its path recipe
推薦閱讀
- Android Wearable Programming
- Node.js 10實戰
- Kibana Essentials
- Maven Build Customization
- RTC程序設計:實時音視頻權威指南
- Oracle從入門到精通(第5版)
- PhoneGap:Beginner's Guide(Third Edition)
- Apache Mahout Clustering Designs
- BIM概論及Revit精講
- Mastering Android Development with Kotlin
- Getting Started with Hazelcast(Second Edition)
- Go語言開發實戰(慕課版)
- Bootstrap for Rails
- PyQt編程快速上手
- Go語言入門經典