Site Talk forum: Non-functioning links to articles

Views: 321, Replies: 7 » Jump to the end
Name: Sue
Ontario, Canada (Zone 4a)
Daylilies Birds Enjoys or suffers cold winters Native Plants and Wildflowers Butterflies Annuals
Region: Canadian Keeps Horses Dog Lover Plant Identifier Garden Sages
Image
sooby
Nov 18, 2016 5:40 AM CST
Does anyone know why (not just on NGA) occasionally a cut and pasted link sometimes isn't "hyperlinked" right to the end, resulting in the link not working? I had this happen in a post on a thread in Ask a Question, the second link down (see below). The 1.pdf is not in blue so a click results in a Page not Found instead of the article:

http://garden.org/thread/view_...
Name: Dave Whitinger
Jacksonville, Texas (Zone 8b)
Region: Texas Million Pollinator Garden Challenge Charter ATP Member I was one of the first 300 contributors to the plant database! Permaculture Raises cows
Beekeeper Vermiculture Garden Ideas: Master Level Garden Sages Plant Identifier Avid Green Pages Reviewer
Image
dave
Nov 18, 2016 7:31 AM CST

Garden.org Admin

Special characters like parenthesis can break the script that converts URLs to hyperlinks. In the Garden.org code I look at certain characters (like spaces) to mean that a URL has ended. Until now, a parenthesis was treated as an end of the URL character.

I updated the code now to allow extra characters in URLs and they should work just fine now.
Name: Joshua
Melbourne, Victoria, Australia (Zone 10b)
Köppen Climate Zone Cfb
Region: Australia Bookworm Cat Lover Lilies Orchids Irises
Seed Starter Annuals Container Gardener Garden Photography Forum moderator
Image
Australis
Nov 18, 2016 8:17 AM CST

Plants Admin

I assume you've taken care of the case where a URL is added to a post in parenthesis, such as "comment (URL)" or "comment (refer to URL)"? I find I often insert URLs that way and was glad Garden.org didn't mess that up (often other sites include the closing parenthesis as part of the URL).
Plant Authorities: Catalogue of Life (Species) --- International Cultivar Registration Authorities (Cultivars) --- RHS Orchid Register --- RHS Lilium Register
My Notes: Orchid Genera HTML PDF Excel --- Lilium Traits HTML PDF --- Lilium Species Crosses HTML PDF Excel --- Lilium Species Diagram
The current profile image is that of Iris 'Volcanic Glow'.
Name: Dave Whitinger
Jacksonville, Texas (Zone 8b)
Region: Texas Million Pollinator Garden Challenge Charter ATP Member I was one of the first 300 contributors to the plant database! Permaculture Raises cows
Beekeeper Vermiculture Garden Ideas: Master Level Garden Sages Plant Identifier Avid Green Pages Reviewer
Image
dave
Nov 18, 2016 8:36 AM CST

Garden.org Admin

This is the regular expression I'm currently using:

$url = '#(^|[\n (])([\w]+?://([^\s<]+)|(www\.[^\s<]+?\.[^\s<]+))(?<![\.,:])#is';

It does have the unfortunate side effect of including the trailing ) as part of the URL. I'm not sure what the right solution is, given that parenthesis in URLs are valid and legal. How can the system be programmed to know whether you intended that character to be a part of the URL, or rather the end of a sentence?
Name: Dave Whitinger
Jacksonville, Texas (Zone 8b)
Region: Texas Million Pollinator Garden Challenge Charter ATP Member I was one of the first 300 contributors to the plant database! Permaculture Raises cows
Beekeeper Vermiculture Garden Ideas: Master Level Garden Sages Plant Identifier Avid Green Pages Reviewer
Image
dave
Nov 18, 2016 8:43 AM CST

Garden.org Admin

Joshua, I just updated the regexp again to try to fix that. Parenthesis at the end of a URL should work fine now.

(Testing: http://fshs.org/proceedings-o/...)
Name: Joshua
Melbourne, Victoria, Australia (Zone 10b)
Köppen Climate Zone Cfb
Region: Australia Bookworm Cat Lover Lilies Orchids Irises
Seed Starter Annuals Container Gardener Garden Photography Forum moderator
Image
Australis
Nov 18, 2016 6:02 PM CST

Plants Admin

Thanks @Dave. I know it can be quite a pain to try to avoid, so all I could think of would be to check if there was a parenthesis just before the URL and pair it to one after the URL.

Otherwise I will fallback to my previous workaround, which was to include a space either side of the URL.
Plant Authorities: Catalogue of Life (Species) --- International Cultivar Registration Authorities (Cultivars) --- RHS Orchid Register --- RHS Lilium Register
My Notes: Orchid Genera HTML PDF Excel --- Lilium Traits HTML PDF --- Lilium Species Crosses HTML PDF Excel --- Lilium Species Diagram
The current profile image is that of Iris 'Volcanic Glow'.
Name: Dave Whitinger
Jacksonville, Texas (Zone 8b)
Region: Texas Million Pollinator Garden Challenge Charter ATP Member I was one of the first 300 contributors to the plant database! Permaculture Raises cows
Beekeeper Vermiculture Garden Ideas: Master Level Garden Sages Plant Identifier Avid Green Pages Reviewer
Image
dave
Nov 18, 2016 6:48 PM CST

Garden.org Admin

Joshua, I got it fixed, actually. I'm checking to see if the URL ends with a parenthesis and if yes, don't include that last character in the URL. It's working well!! (Example: http://www.garden.org/)
Name: Joshua
Melbourne, Victoria, Australia (Zone 10b)
Köppen Climate Zone Cfb
Region: Australia Bookworm Cat Lover Lilies Orchids Irises
Seed Starter Annuals Container Gardener Garden Photography Forum moderator
Image
Australis
Nov 18, 2016 7:16 PM CST

Plants Admin

Thank You!
Plant Authorities: Catalogue of Life (Species) --- International Cultivar Registration Authorities (Cultivars) --- RHS Orchid Register --- RHS Lilium Register
My Notes: Orchid Genera HTML PDF Excel --- Lilium Traits HTML PDF --- Lilium Species Crosses HTML PDF Excel --- Lilium Species Diagram
The current profile image is that of Iris 'Volcanic Glow'.

« Garden.org Homepage
« Back to the top
« Forums List
« Site Talk forum
You must first create a username and login before you can reply to this thread.

Member Login:

Username:

Password:

[ Join now ]

Today's site banner is by bootandall and is called "Cedar Cones"