Hi guys,
I've written a very small snippet to load the content of a TV only if the browser user agent matches those targeted. Basically this my way of keeping the source code clean, hence reducing unnecessary requests.
In this example I've included Chrome in the list to test the output, but the snippet is designed to target mobile browsers.
if( strstr($_SERVER['HTTP_USER_AGENT'],'Chrome') ||
strstr($_SERVER['HTTP_USER_AGENT'],'webOS') ||
strstr($_SERVER['HTTP_USER_AGENT'],'iPhone') ||
strstr($_SERVER['HTTP_USER_AGENT'],'iPad') ||
strstr($_SERVER['HTTP_USER_AGENT'],'iPod')
){
// Load EDGE HTML5 Options
$modx->getObject('modTemplateVar',array('name' => 'VideoPlayer-EDGE-Setup-Message'));
}
This doesn't output anything even if the TV has a value. Is there anything I'm doing wrong?
I've just begun playing with snippets and the MODX API and yes, I'm having my share of headache. But I'm loving it
Thx for your help already