On 24 Dec 2007 in macromedia.dreamweaver, _adrian wrote:
Quote:
So DW8 already has the behaviors built in to take data from a
recordset, and format it (like date, or numbers) .. but I need it to
be able to take the 10 digits from the particular field, and format
it as a phone number: (xxx) xxx-xxxx .... I don't have the
programming skills myself to do this, but if anyone knows of a
tutorial or extension to help, I'd appreciate hearing about it. |
Sorry - missed this in all the holiday hoopla. If you still need it:
<?php if (strlen($row_members['telephone'])>0) { ?>
(<?php echo substr($row_members['telephone'],0,3); ?>) <?php echo substr($row_members['telephone'],3,3); ?>-<?php echo substr($row_members['telephone'],6,4); ?>
<?php }?>
Assumes that the telephone number in the 'telephone' field is a standard
10-digit North American number and uses PHP's substr function to extract
area code, exchange and number. 'telephone' should be of type varchar.
This assumes PHP/MySQL; other models should be similar.
--
Joe Makowiec
http://makowiec.net/
Email:
http://makowiec.net/contact.php