-1

i want so show a telephone number as a "telephonelink" on my website. i show the telephone-numbers with the following php code in my template:

<?php if($employeeObj->getEmail() != "" && $employeeObj->getEmail() != "-"){ ?>
                            <tr>
                                <td colspan="2"><?=$employeeObj->getEmail()?></td>
                            </tr>

how can i implement the telephone number as a link in this php code?

can anybody help me?

tom84
  • 371
  • 1
  • 3
  • 15

1 Answers1

1

It can be done as below:

<?php if($employeeObj->getEmail() != "" && $employeeObj->getEmail() != "-"){ 
$phone = str_replace("/", "", $employeeObj->getEmail());
$phone = str_replace(" ", "", $phone);
?>
<tr>
<td colspan="2"><a href="callto:<?= $phone ?>"><?= $phone ?><a/></td>
</tr>
<?php } ?>
Apoorv
  • 231
  • 1
  • 8
  • thank you... that was what iam looking for... but when i get the telephone numer with getphone() it is callto 0000/11 22 33 but i want the telephone numer in the format: +490000112233 any ideas? – tom84 Feb 22 '16 at 12:20
  • From where are you getting the area code?? And to remove slash and blank space use `str_replace` – Apoorv Feb 22 '16 at 12:23
  • thanks... how can i impelment the `str_replace -` in the php-code from you? – tom84 Feb 22 '16 at 12:36
  • Code update check `str_replace` – Apoorv Feb 22 '16 at 12:52
  • thx... but when i use this i get a php error.. maybe the open `{` must be close and also i want to replace tht `-` can you help me a last time? – tom84 Feb 22 '16 at 13:12
  • Closed the `{` at the end. `` will not be created if condition is not matched Mention the error as well if you get error again – Apoorv Feb 22 '16 at 13:19