Jump to:

23487 Posts in 18996 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » show id in Page_Controller

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

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

Page: 1
Go to End
Author Topic: 1165 Views
  • bebabeba
    Avatar
    Community Member
    192 Posts

    show id in Page_Controller Link to this post

    Hi!

    how can print id page in my Page_Controller?
    I create a funcion that retun $this->ID in my template but i see nothing..help please..

    thanks!

  • Pigeon
    Avatar
    Community Member
    243 Posts

    Re: show id in Page_Controller Link to this post

    I'm not sure exactly what you are trying to do, but...

    To print the current page ID in the template do this:

    $ID

    to access it in the controller or model of the page do:

    $this->ID

    or in a model or controller that isnt the page:

    $this->CurrentPage()->ID

    1165 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.