8.4.2 What's the site root (Home) page id?

Permalink
Could anyone please tell me what the site root (Home) page id is?

Or how do I find that out? That page doesn't have a name or url slug, so I can't use the getByName or getByPath

linuxoid
 
ConcreteOwl replied on at Permalink Reply
ConcreteOwl
Usually it is cID = 1
If you put the page into edit mode does it not display the cID in the browser address bar?
linuxoid replied on at Permalink Reply
linuxoid
8 years after using C5 I learned today it actually shows that... ))) I never noticed

Thank you.

Would you know how to check for its ID programmatically? I have to check a page ID before I delete it to be sure I never delete the root page
ConcreteOwl replied on at Permalink Reply
ConcreteOwl
In 5.6 and 5.7 I would use this
<?php echo $c->getCollectionID() ?>

Don't about Version 8 though..
Gondwana replied on at Permalink Reply
Gondwana
I have a vague feeling that multilingual requirements may have necessitated a change to this (in some cases). I think there was a github issue on it. I don't recall what the resolution was; perhaps bunging something in a config file.
JohntheFish replied on at Permalink Best Answer Reply
JohntheFish
There is a constant called HOME_CID, typically with a value of 1.

There is also Page::getHomePageID() which takes account of locale in a multi-site.
linuxoid replied on at Permalink Reply
linuxoid
Thank you for that. I'll use Page::getHomePageID()