Hi,
I have a database record which contains the contents of an email
and in the email there should be a clickable link.
For some reason the link is not formatting correctly.
Maybe it is something to do with br's and nl's ?
This is what I input in the database record:
-
Then click here to grab a copy of the definitive guide to CPA Marketing!
-
url=http://www.example.net/sp/cpa-cash/]CPA-Cash Profits[/url]
-
-
See you again in part 4.
( I took out the leading [ )
This is what I have in the email:
Quote:
Then click here to grab a copy of the definitive guide to CPA
Marketing!
target="_blank">CPA-Cash Profits
See you again in part 4.
My code now looks like this:
-
$to = $cl_email;
-
$contact = $cl_name;
-
$subject = $camp_row['title'];
-
$cur_mess = $cp_mes;
-
$message_html = eml_bbcode($cur_mess,$contact);
-
$message_html = wordwrap($message_html, 70, "\n");
-
$message_html = nl2br($message_html);
-
$message_html = str_replace("<br />", "<br>", $message_html);
-
$message_html = $message_html."<br><br>
-
and my eml_bbcode() function is:
-
The eml_bbcode() function in there is used to
format the text with html.
-
function eml_bbcode($Text,$client) {
-
-
// Replace any html brackets with HTML Entities to prevent executing HTML or script
-
/
-
// Don't use strip_tags here because it breaks [url] search by replacing & with amp
-
$Text = str_replace("<", "<", $Text);
-
$Text = str_replace(">", ">", $Text);
-
-
// Set up the parameters for a URL search string
-
$URLSearchString = " a-zA-Z0-9\:\/\-\?\&\.\=\_\~\#\'";
-
-
// Perform URL Search
-
$Text = preg_replace("(\[url\=([$URLSearchString]*)\](.+?)\[/url\])", '<a href="$1" target="_blank">$2</a>', $Text);
-
-
// Check for client flag
-
$Text = preg_replace("(\[client\])is","$client",$Text);
-
-
// Check for bold text
-
$Text = preg_replace("(\[b\](.+?)\[\/b])is",'<b>$1</b>',$Text);
The problem is that the
target="_blank"> is not getting
identified as part of the hyperlink, even though is looks like a valid format ( to me ).
Can anyone spot where I have gone wrong ?
Thanks