Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

How to get $this->PageID ?


Go to End


2 Posts   1408 Views

Avatar
Rawbit

Community Member, 52 Posts

31 March 2009 at 6:13am

I have a function inside Page_Controller( .... function myFunction(...)) and I want the Id of the page in question. I tried $this->PageID but that of course tries to access the Page_controller when really I want it from Class Page()

Know what I mean?

Avatar
ajshort

Community Member, 244 Posts

31 March 2009 at 9:31am

You can just call $this->ID on the controller - it will automatically failover to the Page object.