Welcome to Geeklog, Anonymous Sunday, December 22 2024 @ 03:34 am EST

Geeklog Forums

Link target attribute being stripped


Status: offline

DubiousChrisJ

Forum User
Regular Poster
Registered: 05/10/05
Posts: 114
Hey all,
whenever I post a story with an external link that I want to open in a new window, my target attribute is stripped from the link. Is there some other way to post a link which opens externally? I tried both target="new" and target="_blank"
Luhme summa dat GL.
 Quote

Status: offline

DubiousChrisJ

Forum User
Regular Poster
Registered: 05/10/05
Posts: 114
OK, Chuck, I did search the forum... Very Happy I will check around the site some more. The one post I saw that had replies didn't have an answer...
Luhme summa dat GL.
 Quote

Status: offline

DubiousChrisJ

Forum User
Regular Poster
Registered: 05/10/05
Posts: 114
OK, so once and for all, here is the answer: (since I found the answer as snippets across multiple topics)

To allow links on the links page to open in a new window, edit linkdetail.thtml in the layout/(themename)/links. You can add a target attribute to the default link tag for that page specifically.

To allow link targets in stories, edit config.php, in the allowed tags array. For the a tag, add 'target' => 1. This will allow the target tag to be used. Demonstrated here (unlocked tag on story) and here (modified links page tag).

One last question that I didn't see answered. Where do I go to add that attribute to the What's New block on the front page for new links posted there?
Luhme summa dat GL.
 Quote

Status: Banned

machinari

Forum User
Full Member
Registered: 03/22/04
Posts: 1512
Quote by DubiousChrisJ:One last question that I didn't see answered. Where do I go to add that attribute to the What's New block on the front page for new links posted there?


see COM_whatsNewBlock() in lib-common.php.
 Quote

Lunarex

Anonymous
I think this will work only on the links and not the new stories or comments.

Add the target="_blank" tag to two lines in the lib-common.php. Look for $newlinks[] one will be for links over 16 characters and the other for less than 16.

It worked on my site Here!

Let me know if it works.

Lunarex
 Quote

Lunarex

Anonymous
How would you put it in the lib-custom.php so when you do an upgrade you wouldn't loose target tags that was put in the lib-common.php?

Lunarex
 Quote

mach

Anonymous
just delete the function from lib-common and put it into lib-custom. when you upgrade, you'll have to delete the function from lib-common again... easier just to remember your changes--gotta go in there any way.
 Quote

All times are EST. The time is now 03:34 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content