Problems, need help? Have a tip or advice? Post it here.
3 posts Page 1 of 1
hello! I thought this would be a simple thing, but I can't find the solution. I am using a shortcode with the cloak_email tag to generate a mailto link:
Code: Select all
$FUNCS->register_shortcode( 'mail', 'mail_handler' );

function mail_handler( $params, $content=null ){
global $FUNCS;
extract( $FUNCS->get_named_vars(array(
'address' => '',
'link' => ''
), $params) );

$mail = "<cms:get_custom_field 'email_address' masterpage='globals.php' />";
if( empty($address) ) $address=$mail;
if( empty($link) ) $link=$mail;
$html = '<cms:cloak_email email="'.$address.'" title="'.$link.'"  />';

// Pass on the code to Couch for execution using the 'embed' function
return $FUNCS->embed( $html, $is_code=1 );
}


The client has asked for the email subject to be included ... not sure how to do this? Any suggestions? Thanks!
Given that this works:
Code: Select all
<cms:cloak_email email='address@site.com?subject=My Subject' title='Title'/>
You should be able to add an additional 'subject' parameter and incorporate it like so:
Code: Select all
if( !empty($subject) ) $subject='?subject='.str_replace( '"', '\"', $subject );
$html = '<cms:cloak_email email="'.$address.$subject.'" title="'.$link.'" />';
many thanks!
3 posts Page 1 of 1