Inside a block, I need to know if I am on the mobile or desktop page.
I tried to put a variable $isMobile = true; in the indexMobile.php but it is not recognized in my block.
Is there a global variable accessible from insde a block that let me know if I am on the mobile page ?
If not, is there another way to test it from PHP?
I found a dirty way to test it in javascript but I would need it in PHP
Javascript way :
Code: Select all
var pathname = window.location.pathname;
var indexMobile = 'indexMobile';
if(pathname.indexOf(indexMobile) !== -1) {
// do something ..
}

