Missing Target="_blank" for the Website Field
Posted: 30 Mar 2010, 23:01
Hi There,
I need quite fast a solution for the missing target="_blank" part in the entries for websites.
If someone fill in his website, it should open with "_blank" not self.
How should these lines look like?
Current:
<a href="mysite.com">mysite.com</a>
Should be:
<a href="mysite.com" target="_blank">mysite.com</a>
I need quite fast a solution for the missing target="_blank" part in the entries for websites.
If someone fill in his website, it should open with "_blank" not self.
How should these lines look like?
Code: Select all
foreach ($this->items as $key => $values) {
//Maximum of links in the message
$rand = '%phoca' . mt_rand(0,1000) * time() . 'phoca%';
$ahref_replace = "<a ".$rand."=";
$ahref_search = "/<a ".$rand."=/";
$values->content = preg_replace ("/<a href=/", $ahref_replace, $values->content, $this->tmpl['max_url']);
$values->content = preg_replace ("/<a href=.*?>(.*?)<\/a>/", "$1", $values->content);
$values->content = preg_replace ($ahref_search, "<a href=", $values->content);
<a href="mysite.com">mysite.com</a>
Should be:
<a href="mysite.com" target="_blank">mysite.com</a>