Controller class for mobile package.
NOTE: This package uses user-agent sniffing to detect mobile clients. This is far from an exact science and new mobile / 'other' devices are growing at an increasing rate. Please test thoroughly if you have specific devices you want to send content to. The mobile package aids handling mobile versions of sites. It provides simple mobile device detection based on user-agent as well as a set of translators to map between the main and mobile sites. For example simple mappings such as http://www.example.com/mypage/ <---> http://www.example.com/mobile/mypage/ and more complex ones where pages are specific to the type of site such as: http://www.example.com/mypage/ <---> http://www.example.com/mobile/mypage/ http://www.example.com/mypage/a ---> http://www.example.com/mobile/mypage/ http://www.example.com/mypage/ <--- http://www.example.com/mobile/mypage/b
package | dstruct_mobile |
---|
__construct(object $urltranslator, string $url)
You must have a 'mobile_agent' setting in Prefs which contains the user-agents to detect as 'mobile' browsers.
object
Translator class to use.
string
would usually be passed if using as a link-clicked switcher
\DStructGeneralException |
---|
checkForRedirect()
If not then redirect user. Ignores any previous checks.
doSwitch()
This must be called BEFORE there is any output to the browser as otherwise you will get an error.
getInversePage(string $url) : string
string
Page we want to find the inverse mapping of
string
isMobileAgent() : boolean
boolean
onMobilePage()
$url : string
$urltranslator : object