Page 1 of 1

Links in new window

Posted: 10 Apr 2009, 16:02
by hbrui
Hi,

and here is my second problem: Links users ad into their posts should open in a new window (Target _blank). I tried to modyfy tinymce theme, change com_phocaguestbook\views\phocaguestbook\tmpl\default.php to allow "target" in HTML-purifier but still links in guestbook entries are shown in the same window (target _self). Any hints for me?

Thanks in advance
Bernd

Re: Links in new window

Posted: 10 Apr 2009, 23:04
by Jan
maybe you can use some php function like str_replace:

str_replace("_self", "_blank", $message);

Jan

Re: Links in new window

Posted: 11 Apr 2009, 20:34
by hbrui
Thanks for your tip, Jan.

But as I`m not fit in php (only basic understanding when reading existing code) I won`t be able to ad such functions. If it is just a tiny bit of code I have to ad into an existing file, maybe you could give me some instruction here. Otherwise, I keep the link-functionality disabled for my users. (I removed the link and unlink button and set display links to zero). As I posted before: all links in guestbook erntries should open in new window (target _blank), regardless if and what target user enters.

Greetings, Bernd

Re: Links in new window

Posted: 14 May 2010, 15:29
by Janosch
Ahoj Jan,
Nemám najít Misto, kde jsem dal kód:
str_replace ("_self", "_blank", $ message);
muze vstoupit.
Prosím, Budte laskaví tak, jak PSAT ve kterém souboru, instalované na místě Kodu JE umožnit kterém propojení adresy otevřít v novem okně. Děkuji Vám ein
 Ahoj Stefan und Karussell-Fanclub aus Berlin / Leipzig

Re: Links in new window

Posted: 14 May 2010, 16:17
by Jan
com_phocaguestbook\views\phocaguestbook\tmpl\default.php

Before displaying the output, the str_replace will be done

Find the variable which include the output (I am sorry, I am not on my PC so I don't know its name) and add the str_replace function to this variable.

Jan

Re: Links in new window

Posted: 14 May 2010, 17:37
by Janosch
Ahoj,
Problem solved:
default.php file in line 160

Code: Select all

$gbPosts .= '<span><a href="'.$values->homesite.'">'.PhocaguestbookHelper::wordDelete($values->homesite, 50, '...').'</a></span>';
changed to:

Code: Select all

$gbPosts .= '<span><a href="'.$values->homesite.'"target="_blank">'.PhocaguestbookHelper::wordDelete($values->homesite, 50, '...').'</a></span>';
Greetings to Czech Republic and thanks for the nice guestbook
Stefan

Re: Links in new window

Posted: 15 May 2010, 14:31
by Jan
Great.

Jan

Re: Links in new window

Posted: 15 May 2010, 14:39
by pajuba
Hallo
danke diese Lösung habe ich auch gesucht!