Web addresses not handled right...
- Topic Author
13 years 4 months ago #297
by
Web addresses not handled right... was created by
I have a database with members website addresses as one of the fields.
When joodb displays it, it displays it as it shows in the database. But, when you roll over it with the mouse, the link it shows is "http//www.something.com" without the ":" (colon). This causes the link to fail because it's not properly formed.
So, database has:
www.something.com
joodb created URL shows:
http//www.something.com
Could this really have been overlooked for this long?
When joodb displays it, it displays it as it shows in the database. But, when you roll over it with the mouse, the link it shows is "http//www.something.com" without the ":" (colon). This causes the link to fail because it's not properly formed.
So, database has:
www.something.com
joodb created URL shows:
http//www.something.com
Could this really have been overlooked for this long?
Please Log in to join the conversation.
- Fred
- Topic Author
13 years 2 weeks ago #443
by Fred
Replied by Fred on topic Re:Web addresses not handled right...
There is a problem with the php code. I got it the other way:
DB entry was www.example.com
When a user then clicks on it the browser it comes up with an error, cause the link will be:
http://http://www.example.com
Also when you hover over the link it shows the double http://http://
Update the code in helpers/joodb.php
from:
if ($params->get('link_urls')) {
// try to detect and link urls and emails
if (preg_match('/^[^@]+@[a-zA-Z0-9._-]+\.[a-zA-Z]+$/', $field)) {
$field= JHtml::_('email.cloak', $field);
} else if (strtolower(substr($field,0,4))=="www.") {
$field= '<a href="http://'.$field.'" target"_blank">'.$field.'';
} else if (strtolower(substr($field,0,4))=="http") {
$field= '<a href="http://'.$field.'" target"_blank">'.$field.'';
to
if ($params->get('link_urls')) {
// try to detect and link urls and emails
if (preg_match('/^[^@]+@[a-zA-Z0-9._-]+\.[a-zA-Z]+$/', $field)) {
$field= JHtml::_('email.cloak', $field);
} else if (strtolower(substr($field,0,4))=="www.") {
$field= '<a href="http://'.$field.'" target"_blank">'.$field.'';
} else if (strtolower(substr($field,0,4))=="http") {
$field= '<a href="'.$field.'" target"_blank">'.$field.'</a>';
And it should work
DB entry was www.example.com
When a user then clicks on it the browser it comes up with an error, cause the link will be:
http://http://www.example.com
Also when you hover over the link it shows the double http://http://
Update the code in helpers/joodb.php
from:
if ($params->get('link_urls')) {
// try to detect and link urls and emails
if (preg_match('/^[^@]+@[a-zA-Z0-9._-]+\.[a-zA-Z]+$/', $field)) {
$field= JHtml::_('email.cloak', $field);
} else if (strtolower(substr($field,0,4))=="www.") {
$field= '<a href="http://'.$field.'" target"_blank">'.$field.'';
} else if (strtolower(substr($field,0,4))=="http") {
$field= '<a href="http://'.$field.'" target"_blank">'.$field.'';
to
if ($params->get('link_urls')) {
// try to detect and link urls and emails
if (preg_match('/^[^@]+@[a-zA-Z0-9._-]+\.[a-zA-Z]+$/', $field)) {
$field= JHtml::_('email.cloak', $field);
} else if (strtolower(substr($field,0,4))=="www.") {
$field= '<a href="http://'.$field.'" target"_blank">'.$field.'';
} else if (strtolower(substr($field,0,4))=="http") {
$field= '<a href="'.$field.'" target"_blank">'.$field.'</a>';
And it should work
Please Log in to join the conversation.
Moderators: Dirk, joest