Posted by Grant
2014-05-08

Hi
Fantastic script I was just wondering if it was possible to change the output of one of the text fields such as email to be a clickable URL i.e. mailto:N@N.com or http//.
Thanks
Posted by Tom
2014-05-08

Hi Grant,

>wondering if it was possible to change the output of one of the text fields such as email to be a clickable

First, you need this helper function. Open web/staff/common.inc.php in a text editor, and put the following line on the top, then the function will be available anywhere inside the web/staff folder.
<?php function getTextValue( $key, $val ){ return isset($val->attri['value']) ? $val->attri['value'] : ""; } ?>
Second, open the template ( web/staff/tpl.(table-name).detail.inc.php ) in a text editor. Find the field placeholder you want to change the output format of. It looks like this:
<?php echo $hm->Zb('rs:def:email'); ?>
Probably you already know that this will print out an input box with an email address inside. What you need is just an email address without the input box. To remove the input box, add ",ZB_CBF,'getTextValue'" to it like this:
<?php echo $hm->Zb('rs:def:email',ZB_CBF,'getTextValue'); ?>
Open the page in your browser, you will see the email address without input box. The last step is put the email address in an <a> tag. The result should look like:
<a href="mailto:<?php echo $hm->Zb('rs:def:email',ZB_CBF,'getTextValue'); ?>">Email me!</a>