21278 Posts in 5728 Topics by 2599 members
General Questions
SilverStripe Forums » General Questions » Test if a page is being accessed from the administrative area
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, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 406 Views |
-
Test if a page is being accessed from the administrative area

10 August 2010 at 1:45am
How can I test if a page is being accessed from the administrative area?
function canView() {
if( IF_YOU_ARE_IN_THE_ADMINISTRATIVE_AREA ) {
return true;
} else {
return false;
}
} -
Re: Test if a page is being accessed from the administrative area

10 August 2010 at 12:37pm
Thanks to Martijn and simon_w for helping with this in the forums.
Controller::curr() can be used to test the object type.
And SSViewer::current_theme() can be used to for a theme.
For example,
function canView() {
if(SSViewer::current_theme()===null) {
return true;
}
else {
return false;
}
}
| 406 Views | ||
|
Page:
1
|
Go to Top |

