Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Counting digits for Phone number

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
Laangelinaj
Smarty n00b


Joined: 23 Jan 2014
Posts: 1

PostPosted: Thu Jan 23, 2014 9:19 am    Post subject: Counting digits for Phone number Reply with quote

Hi, I'm a newbie in smarty
And i got problem with my smarty

I want to make a condition to get 1 phone number from the user either phone or phone2. And also i want to check whether it's 10 digits for every phone number. Then I want to add 0 in front of the phone number when the phone number just 9 digits.
My code below:

{if !isset($PHONE) && $PHONE2|substr:0:10==''}'0{$PHONE2}{else if !isset($PHONE)}'{$PHONE2}{else if isset($PHONE) && $PHONE != ''&& $PHONE|substr:0:10==''}'0{$PHONE}{else}'{$PHONE}{/if}

By the way, I'll put the code on CSV
Really thanks for the help before Smile
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP