Links in new window

Phoca Guestbook - creating guestbooks in Joomla! CMS
hbrui
Phoca Newbie
Phoca Newbie
Posts: 5
Joined: 10 Apr 2009, 15:47

Links in new window

Post 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
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48736
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Links in new window

Post by Jan »

maybe you can use some php function like str_replace:

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

Jan
If you find Phoca extensions useful, please support the project
hbrui
Phoca Newbie
Phoca Newbie
Posts: 5
Joined: 10 Apr 2009, 15:47

Re: Links in new window

Post 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
Janosch
Phoca Newbie
Phoca Newbie
Posts: 2
Joined: 14 May 2010, 15:16
Location: Berlin / Leipzig
Contact:

Re: Links in new window

Post 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
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48736
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Links in new window

Post 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
If you find Phoca extensions useful, please support the project
Janosch
Phoca Newbie
Phoca Newbie
Posts: 2
Joined: 14 May 2010, 15:16
Location: Berlin / Leipzig
Contact:

Re: Links in new window

Post 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
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48736
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Links in new window

Post by Jan »

Great.

Jan
If you find Phoca extensions useful, please support the project
pajuba
Phoca Member
Phoca Member
Posts: 13
Joined: 26 Mar 2010, 13:22

Re: Links in new window

Post by pajuba »

Hallo
danke diese Lösung habe ich auch gesucht!
Post Reply