Page 1 of 1

User agent deciding which Template to use?

Posted: Mon Mar 03, 2014 7:50 am
by pwg
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.

Re: User agent deciding which Template to use?

Posted: Mon Mar 03, 2014 8:13 am
by Rolf

Re: User agent deciding which Template to use?

Posted: Tue Mar 04, 2014 1:51 am
by pwg
Thanks Rolf, much appreciated.

I wasn't able to get the UDT tag working, but was able to use the method described combined with the mobiledetect plugin to display different templates depending on the user-agent.

My only concern however is page loading speed - essentially now each template is two templates (mobile / desktop).

Is this the best or recommended way to load templates depending on the device used?

I was actually on Goran's site yesterday and didn't even notice this article, so thanks again.

Cheers,

Paul

Re: User agent deciding which Template to use?

Posted: Tue Mar 04, 2014 9:09 am
by velden
CMSMS requires you to have one and only one template per content page. So you can not have a separate mobile template and a desktop template.

The method mentioned above is good (else it wouldn't even be on that blog). Page loading will not suffer from this method because the webserver will ONLY serve the content for the specific device.

The webserver (php engine) will, however, need to parse a slightly larger template, but I guess that will not really influence the overall speed of the website.