9
Anonymous
Re:Setting the target for links in some blocks
  • 2007/6/14 19:37

  • Anonymous

  • Posts: 0

  • Since:


Quote:
When I use bb code to make the link XOOPS automatically inserts target="_blank" into the link which causes the link to open a new window.


Rather than use the [url].....[/url] bb code, I've found that "siteurl" works in some cases, i.e.:

[ siteurl=yourlink ]LinkText[ /siteurl ]

Remove the spaces after [ and before ]

When this works it has the effect of opening the link in the same window. It works in some modules (e.g. Forums (obviously!) & ExtCal) but I'm not sure about about blocks (might have to play about with the settings/format).

HTH

8
optikool
Re:Setting the target for links in some blocks
  • 2007/6/14 19:25

  • optikool

  • Not too shy to talk

  • Posts: 154

  • Since: 2007/3/26


This would be a great option if it was only limited to my site. I'm making a module that other users can use, but I don't want to tell them to modify core XOOPS just to get my module to work. Is there a way to format my code so that I can format it myself? Here is the code I have...

if ($movies !== "") {
if ($movies_target == "No") {
$moviesURL = "<a href='$movies'>"._XD_MOVIES."</a>"; $xoopsTpl->assign('movies',$moviesURL);
} else {
$moviesURL = "<a href='$movies' target='_blank'>"._XD_MOVIES."</a>";
$xoopsTpl->assign('movies',$moviesURL);
}
} else {
$xoopsTpl->assign('movies',"");
}

In this code I'm giving the user the option to set the _blank target if they wish, else keep it on the same page. Is there something I can do to tell XOOPS not to format what I created? Thanks for your help.

7
chipthamac
Re:Setting the target for links in some blocks
  • 2005/2/15 19:29

  • chipthamac

  • Just popping in

  • Posts: 28

  • Since: 2005/1/4 2


Quote:

balancedi wrote:
To Guido:
When XOOPS interpets bb code links it adds target="_blank". So it reads:

[URL=yourlink]LinkText[/URL]

and changes it to:

<a href="yourlink" target="_blank">LinkText</a>

This forces a new window to open. If it simply left off the target="_blank" then the link would open in the current window. I'm not exactly sure why XOOPS does this. Maybe its some standard method of interpeting bb code.

At any rate, to make this easier for my users that aren't HTML savvy I edited the XOOPS core. For me this didn't seem to have any detrimental side effects on the rest of XOOPS. I edited the file /html/class/module.textsanitizer.php. There is a small function in there called &xoopsCodeDecode that handles this. I just removed everything that said target="blank". (Note: always make a backup before editing code.)


To Anyone:
Is there a way for me to recommend this little change to the XOOPS developers?


Solo71:
Thanks for the tip about Edito and multiMenu. They won't help me with this specific problem but they really look like very handly modules.


This worked great for me as well. I made of custom block where I post the urls of new media that I post. I didn't want it to open up in a new window, because that's just bad form. :p
I didn't know the file that I needed to edit and actually found this post. awesome. I opened the file in wordpad, did a find - replace on the edit menu and plugged in target="_blank" into the find slot and left the replace slot blank. Then I clicked replace, opened up my ftp program, renamed the /html/class/module.textsanitizer.php to /html/class/module.textsanitizer.bak, then uploaded the edited file.
Worked like a charm with no errors thus far.
Thanks guys.

6
balancedi
Re:Setting the target for links in some blocks
  • 2004/10/24 4:47

  • balancedi

  • Friend of XOOPS

  • Posts: 5

  • Since: 2004/8/11


To Guido:
When XOOPS interpets bb code links it adds target="_blank". So it reads:

[URL=yourlink]LinkText[/URL]

and changes it to:

<a href="yourlink" target="_blank">LinkText</a>

This forces a new window to open. If it simply left off the target="_blank" then the link would open in the current window. I'm not exactly sure why XOOPS does this. Maybe its some standard method of interpeting bb code.

At any rate, to make this easier for my users that aren't HTML savvy I edited the XOOPS core. For me this didn't seem to have any detrimental side effects on the rest of XOOPS. I edited the file /html/class/module.textsanitizer.php. There is a small function in there called &xoopsCodeDecode that handles this. I just removed everything that said target="blank". (Note: always make a backup before editing code.)


To Anyone:
Is there a way for me to recommend this little change to the XOOPS developers?


Solo71:
Thanks for the tip about Edito and multiMenu. They won't help me with this specific problem but they really look like very handly modules.

5
tripmon
Re:Setting the target for links in some blocks
  • 2004/10/21 21:25

  • tripmon

  • Module Developer

  • Posts: 462

  • Since: 2004/2/28


Guido

as opposed to using bb code, which is hard coded to open a new window:
[URL=yourlink]LinkText[/URL]

use HTML to launch a link in the same window.
<a href="yourlink">LinkText</a>

you will need to use HTML formatting in the drop down box below the text area.

As far as changing the bb code function, it would cascade to additional areas where [URL] is used and may present problems. You could change the bbcode call and add a variable, but it's not worth the trouble in my opinion.

4
Guido83
Re:Setting the target for links in some blocks
  • 2004/10/21 15:03

  • Guido83

  • Just popping in

  • Posts: 60

  • Since: 2003/12/7


Same problem here... I would like to know what you mean with "create the link with HTML code". Thanks!

3
solo71
Re:Setting the target for links in some blocks
  • 2004/10/20 21:02

  • solo71

  • Module Developer

  • Posts: 941

  • Since: 2003/1/29


Two possible solutions :

1) use html code (your do what you want more precisely)

2) use multiMenu. Even more simple.

As for tiny content, have you tried Edito ?


2
God-fearer
Re:Setting the target for links in some blocks
  • 2004/10/14 22:17

  • God-fearer

  • Just popping in

  • Posts: 8

  • Since: 2004/10/11


Someone answer this ... i'm one of the idiots who doesn't know how.

1
balancedi
Setting the target for links in some blocks
  • 2004/9/6 17:22

  • balancedi

  • Friend of XOOPS

  • Posts: 5

  • Since: 2004/8/11


I have a very simple custom block on my top page with a link to another content page. When I use bb code to make the link XOOPS automatically inserts target="_blank" into the link which causes the link to open a new window.

The only way I've found to get around this is to create the link with HTML code. This is fine for me but, the others that administer the site aren't HTML savvy and perfer to use the bb code.

I have the same problem with a block created with the Tiny Content module.

Is there an easy way to stop XOOPS from inserting the target="_blank" ?

Thanks in advance.


Login

Who's Online

210 user(s) are online (138 user(s) are browsing Support Forums)


Members: 0


Guests: 210


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits