-
- 620 Posts
Hi,
I was looking around for a plugin that will be able to strip out HTML nodes from a resource baqsed on device & viewport size. i.e. if I am using bootstrap, and a mobile phone comes along instead of just not displaying class="hidden-xs" elements I'd much rather have modx strip out the HTML before the document is parsed!
obviously I need some kind of plugin that detects the device and passes the info on to my plugin then a plugin to strip the node...
Any thoughts on how to approach this?
[and no, javascrtipt is not an option
]
*** Not just websites, we also create signage, banners, print, trade show displays and more! ***
Sean Kimball CLP, CLS.
Technical Director / Sr. Developer | BigBlock Studios
._______________________________________________.
Bigblock Studios
http://www.bigblockstudios.ca Web site design & development.
27-1300 King Street East. Box 167 Oshawa, Ontario L1H8J4 Canada.
phone/fax: 905-426-5525
-
- 5,888 Posts
with this method
http://www.forum.jolichter.de/index.php?topic=224.0
it should be possible to have:
place that at top of your template:
[[!detectMobileBrowsers]]
and use the generated placeholder like that:
[[+getBrowser:is=`mobile`:then=``:else=`hidden-xs`]]
or have another snippet 'hidden-xs':
if ($modx->getPlaceholder('getBrowser') != 'mobile'){
return 'hidden-xs';
}
and use it like that:
-
- 620 Posts
@Bruno17
Interesting, the plugin isn't aware of screen sizes [which I think is only available to javascript [DAMN!!] - but that's actually the least of my concerns...
Modifying templates and HTML is something I want to avoid as this would be something nice to drop into an existing modx site without having to do a bunch of grunt work.
I guess the important thing is when is the information we need available and when does modx process it all, the user agent is available in the request & I guess available before modx really does anything - the viewport size without javascript. [maybe an investigation on how media queries work?] more trickier.
*** Not just websites, we also create signage, banners, print, trade show displays and more! ***
Sean Kimball CLP, CLS.
Technical Director / Sr. Developer | BigBlock Studios
._______________________________________________.
Bigblock Studios
http://www.bigblockstudios.ca Web site design & development.
27-1300 King Street East. Box 167 Oshawa, Ontario L1H8J4 Canada.
phone/fax: 905-426-5525
-
- 620 Posts
*** Not just websites, we also create signage, banners, print, trade show displays and more! ***
Sean Kimball CLP, CLS.
Technical Director / Sr. Developer | BigBlock Studios
._______________________________________________.
Bigblock Studios
http://www.bigblockstudios.ca Web site design & development.
27-1300 King Street East. Box 167 Oshawa, Ontario L1H8J4 Canada.
phone/fax: 905-426-5525