17691 Posts in 4607 Topics by 2180 members
General Questions
SilverStripe Forums » General Questions » currentPageID() for unique names?
General questions about getting started with SilverStripe that don't fit in any of the categories above.
Moderators: martimiz, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba
|
Page:
1
|
Go to End | |
| Author | Topic: | 841 Views |
-
currentPageID() for unique names?

18 February 2009 at 1:39pm Last edited: 18 February 2009 1:45pm
I am trying to use currentPageID() in a widget I am building, in order for the widget to be installed on several different pages (without having to manually set a unique id). I thought that currentPageID() would do the job, however, I cant get it to work.
Here is the code in question
function pageID() {
return currentPageID();
}I am obviously using this wrong, but I cant find any examples of it being used. Is there an easier way to have a unique page id?
-
Re: currentPageID() for unique names?

14 May 2009 at 1:50pm
I have no idea about writing widgets, so this might be totally unhelpful, but...
can you just use $this->ID (in the code) or $ID in the template.
And in your code, shouldn't it be $this->currentPageID() ?
| 841 Views | ||
|
Page:
1
|
Go to Top |


