Page 1 of 1

Missing Target="_blank" for the Website Field

Posted: 30 Mar 2010, 23:01
by michael-zitrox
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?

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);
Current:
<a href="mysite.com">mysite.com</a>

Should be:
<a href="mysite.com" target="_blank">mysite.com</a>

Re: Missing Target="_blank" for the Website Field

Posted: 03 Apr 2010, 21:37
by michael-zitrox
no one?

Re: Missing Target="_blank" for the Website Field

Posted: 04 Apr 2010, 13:28
by Jan
It seems like you need some special regular expression, but it is no easy so this needs to be adviced by some regular expression expert :-(

Jan

Re: Missing Target="_blank" for the Website Field

Posted: 05 Apr 2010, 19:00
by michael-zitrox
this should be more than easy for the devs.. they used it anyway a few lines above.

by the way, i can't understand, why someone would create links without a target, i mean.
this is basic html.

Re: Missing Target="_blank" for the Website Field

Posted: 08 Apr 2010, 11:39
by Jan
Hi,
by the way, i can't understand, why someone would create links without a target, i mean.
this is basic html.
the problem is, target is not basic html feature, e.g. in xhtml strict the target is not valid attribute. So if there is an open source project which can be used by different site, there should be added only basic features so they can be then customized.

second problem is, this is not feature of Phoca Guestbook, the links are set by the editor, so maybe this should be the question on editor developers :-( :-(

Jan

Re: Missing Target="_blank" for the Website Field

Posted: 08 Apr 2010, 22:50
by michael-zitrox
editor? no.
in the latest guestbook version, there is an "website" text-field.
so the url shouldn't be in an editor field.

Re: Missing Target="_blank" for the Website Field

Posted: 10 Apr 2010, 15:11
by Jan
Aha, sorry I didn't understand it correctly, I thought, you are speaking about links in editor.

This you can customize in the code, see:
components\com_phocaguestbook\views\phocaguestbook\tmpl\default.php

cca line 160 - just add the target="_blank" there.

Jan

Re: Missing Target="_blank" for the Website Field

Posted: 10 Apr 2010, 21:23
by michael-zitrox
aaaaaaah "homesite" ;)
i searched all files for "website" ;)

Thanks a lot.

Re: Missing Target="_blank" for the Website Field

Posted: 14 Apr 2010, 18:27
by Jan
Ok