21491 Posts in 5783 Topics by 2622 members
| Go to End | Next > | |
| Author | Topic: | 1173 Views |
-
Frontend or backend - how found out

26 January 2011 at 3:35am
How can I found out programaticaly where am I in frontend or backand?
-
Re: Frontend or backend - how found out

26 January 2011 at 5:06am
hmmmm - how about if your url segment begins "admin"?
-
Re: Frontend or backend - how found out

26 January 2011 at 5:25am Last edited: 26 January 2011 5:28am
No.
I'm trying:class StatisticsExtender extends DataObjectDecorator {
function contentControllerInit() {
$cur_url = explode("?",$_SERVER['REQUEST_URI']); // I expecting 'admin'
$params = Director::urlparams();
$controller = Director::urlParam('Controller');
$be = is_subclass_of($controller,"LeftAndMain");
$frontend = ((isset($params['Controller']) && $params['Controller'] == 'RootURLController') || !isset($params['URLSegment']) || (isset($params['URLSegment']) && $params['URLSegment'] != 'sapphire') ? 1 : 0);
$backend = ((isset($params['URLSegment']) && $params['URLSegment'] == 'sapphire') ? 1 : 0);
//...
}
//...
}No success.
-
Re: Frontend or backend - how found out

26 January 2011 at 5:29am
hmmm well I'd say it would be something in director... Director::get_current_page() and then get the URLsegment from there...
what is it that you are going to use this information for?
-
Re: Frontend or backend - how found out

26 January 2011 at 5:32am
I'm trying to write statistic module with optional params: use for frontend || use for backend || use for all.
-
Re: Frontend or backend - how found out

26 January 2011 at 5:52am
how about tracking when someone is logged in? non-logged in would mean frontend
any road - I would just track the pages and then worry about how to filter based on "this is an admin url" later. Also I'd ensure the tracking only occurs when (!Director::is_ajax())
-
Re: Frontend or backend - how found out

26 January 2011 at 5:59am
User can be loged in frontend and backend, right?
You know, in my own CMS I wrote modules, I can read params from xml as it has e.g. Joomla!.
I want the same functionality in SS (e.g. in SS SiteConfig), and I want to know where user sit frontend/backend.
I don't want to use google or piwik (via javascript) nor call from template. -
Re: Frontend or backend - how found out

26 January 2011 at 6:04am
>> User can be loged in frontend and backend, right?
true, but I am implying that if they are not logged in and it is not ajax it will be a frontend page.
| 1173 Views | ||
| Go to Top | Next > |


