Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.3.4

Request #10315 Template parameter to addMailTo()
Submitted: 2007-03-09 20:55 UTC
From: stoyan Assigned: cweiske
Status: Closed Package: HTML_Crypt (version 1.3.1)
PHP Version: 5.1.2 OS: Windows
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 48 + 24 = ?

 
 [2007-03-09 20:55 UTC] stoyan (Stoyan Stefanov)
Description: ------------ For a project I needed <a href="mailto: ..> tag that is different from the default one. Different text and some attributes to the A tag. This can be solved if addMailTo() accepts an optional template parameter. (See test script) Test script: --------------- Modified addMailTo(): <?php function addMailTo($template = '<a href="mailto:%email%">%email%</a>') { $email = $this->text; $this->text = str_replace('%email%', $email, $template); } ?> To get a result same as the current implementation you can skip the template parameter, or you can provide your own template to get a custom result: <?php $c = new HTML_Crypt('yourname@example.com', 8); // same as current $c->addMailTo(); // custom href text $c->addMailTo('<a href="mailto:%email%">My text</a>'); // custom text and attribute, modified href attribute $c->addMailTo('<a href="mailto:%email%?subject=Email me" class="beauty">My text</a>'); $c->output(); ?>

Comments

 [2007-04-04 12:13 UTC] cweiske (Christian Weiske)
Thank you for your bug report. This issue has been fixed in the latest released version of the package, which you can download at http://pear.php.net/get/HTML_Crypt