Jump to content

Recommended Posts

Posted

Hi all.
I need to change $config->paths->data['templates'] value from "templates" to "m_templates" for example.

I think this wil be more easy to use specific folder for mobile view.

How to change depending on some actions? (detecting if site viewing on mobile browser)

Thanks

Posted

Never done that (I usually use responsive CSS frameworks like UIkit to allow smooth scaling with a single set of templates), but you might have a look at @justb3a's MobileDetect module. With it, you should be able to adapt the paths (with code in site/init.php, not config.php, since the module needs to be initialized first) like in this recipe.

  • Like 1
Posted
On 28.02.2017 at 5:02 PM, BitPoet said:

Never done that (I usually use responsive CSS frameworks like UIkit to allow smooth scaling with a single set of templates), but you might have a look at @justb3a's MobileDetect module. With it, you should be able to adapt the paths (with code in site/init.php, not config.php, since the module needs to be initialized first) like in this recipe.

Thanks for recipe. It works well but i can't get values before selecting template (

So if i put this code in init.php nothing works. I think it's because at this step there is no variable mobileDetect

if($config->mobileDetect->deviceType!='desktop'){	
    $config->urls->templates = $config->urls->site . 'm_templates/';
    $config->paths->templates = $config->paths->site . 'm_templates/';
}

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...