User agent deciding which Template to use?

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Locked
thehay95
New Member
New Member
Posts: 2
Joined: Fri Aug 24, 2018 4:09 pm
Contact:

User agent deciding which Template to use?

Post by thehay95 »

I'm updating a client site and whilst it will be a responsive design, I was hoping there would be a way for mobile users to be receive a different template to tablet and desktop users?

I installed the Mobiledetect plugin, and whilst it can identify mobile users, my smarty skills are crap, and so I’m not sure how to get it to send users to designated templates.

I'm doing this as desktop has to be IE 8 compatible, but I want mobile to use an Off canvas navigation. I also just want to know how to do it.

Any advice appreciated.
User avatar
DIGI3
Dev Team Member
Dev Team Member
Posts: 1629
Joined: Wed Feb 25, 2009 4:25 am
Location: Victoria, BC

Re: User agent deciding which Template to use?

Post by DIGI3 »

Easiest might be to use generic templates for the parts that are different, and keep both on the same master template. So something like this in your master template (possibly edited to work with your mobiledetect plugin):

Code: Select all

{if $mobile}
  {include file="cms_template:mymobiletemplate}
{else}
  {include file="cms_template:mydesktoptemplate}
{/if}
Not getting the answer you need? CMSMS support options
Locked

Return to “Modules/Add-Ons”