Page 1 of 1

[solved] UDT to write alternative content for smartphones ?

Posted: Mon Feb 18, 2013 5:22 pm
by VincentRivard
Hi there,

First post here. French is my native language. Sorry if any language bloopper.

Most smartphones get

<a href="tel:1 800 555 5555">Call us free!</a>

and dial the number, but I dont want the link to get in the way for non smartphones, since the client cant afford an alternative version for them.

How could I detect smartphones and write

<a href="tel:1 800 555 5555">Call us free!</a>

else

1 800 555 5555

I dream of a simple UDT since it would be used on many pages.

Re: Simple UDT to write alternative content for smartphones

Posted: Tue Feb 19, 2013 1:39 pm
by fredp
Hi,

Do you think this RFC "recommendation" would help?
RFC3966: Usage of Telephone URIs in HTML

Re: Simple UDT to write alternative content for smartphones

Posted: Tue Feb 19, 2013 1:51 pm
by VincentRivard
Hi fredp,

Yes it would help a bit, but not for writing an UDT to detect smartphones, which was the question.

Thank you for this information. If i can find a way to do so, the phone number will be properly displayed according to those recommendations.

Re: Simple UDT to write alternative content for smartphones

Posted: Tue Feb 19, 2013 3:25 pm
by uniqu3
You can look at CGExtensions or ToolBox modules, both come with Mobile detection plugins/functions, just read Module Help to find out how and where.

Else you can go with a custom made UDT or Plugin using for example Mobile Detect Class that can be found here http://code.google.com/p/php-mobile-detect/

Re: Simple UDT to write alternative content for smartphones

Posted: Tue Feb 19, 2013 4:02 pm
by VincentRivard
Thanks uniqu3,

i have just had a quick look at these ressources and it seems everything i need is there.

Sorry for my 'newbie' question. It's the first time i play with CMSMS, and i like it a lot already.

The client is familiar with it, and introduced (forced) it to me.

Glad he did.

Got this from CGExtensions. It needs to be installed.

Code: Select all

{cge_is_smartphone assign='mobile'}{if $mobile}<a href="tel:555 5555">555 5555</a> 
{else}555 5555{/if}

Re: [solved] UDT to write alternative content for smartphone

Posted: Thu Feb 21, 2013 8:01 pm
by uniqu3
Glad it worked for you ;) and thanks to your client for showing you CMSMS, welcome!

Happy coding.