简体   繁体   中英

TYPO3 change view file for a specific action

I'm working with TYPO3, and now I need difference appearance for a specific page. Example: for testAction I need a view name Test.html that's on PC So, I wonder if there is a way to change the view file when browsing by mobile?

Something like this :

if (self::isMobile()) {
    change view file = 'mobile.html'
}

Thanks in advance.

Sorry but this is not possible as the server doesn't know anything about the client's capabilities like if it is a phone or the screen size!

Best would be to check this via JavaScript, eg using https://modernizr.com/ or check out eg What is the best way to detect a mobile device in jQuery? . In the template you would render both types and depending on the JS check show/hide the content.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM