Hi, everyone this a simple tutorial to make website url clickable on item page. I done it for myself and thought that it would be worth to share with everyone here. If someone is interested can follow these easy steps. I assuming that you have some basic experience with Osclass.
It will work on all custom field with any name.
1. Now open your theme's 'function.php' file and add this function in the end.
function osc_make_clickable($text) {
//Convert all urls to links
$text = preg_replace('#([\s|^])(www)#i', '$1http://$2', $message);
$pattern = '#((http|https|ftp|telnet|news|gopher|file|wais):\/\/[^\s]+)#i';
$replacement = '<a href="$1" target="_blank" rel="nofollow">$1</a>';
$text = preg_replace($pattern, $replacement, $text);
/* Convert all E-mail matches to appropriate HTML links */
$pattern = '#([0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.';
$pattern .= '[a-wyz][a-z](fo|g|l|m|mes|o|op|pa|ro|seum|t|u|v|z)?)#i';
$replacement = '<a href="mailto:\\1">\\1</a>';
$text = preg_replace($pattern, $replacement, $text);
return $text;}
2. Ok now open your 'item.php' file you can find in your default theme folder at line '96' and replace below code
<strong><?php echo osc_item_meta_name(); ?>:</strong> <?php echo osc_item_meta_value(); ?>
with this one
<strong><?php echo osc_item_meta_name(); ?>:</strong>
<?php $text=osc_item_meta_value();
echo osc_make_clickable($text);
?>
Thats it !
It is working fine with my installation but i can't not bet that it will work for you too . Please backup you files before any modification.