Hello dear Forum,
I am quite new in here and this is my first post, but I have run into little problem with one of my project I am developing. For more clearly, I need to get PHP code ($new_link), which gets it’s link from database ($new_link = $business->linkto , where $business->linkto is the path for getting link from database).
Problem is that I want to make this $new_link or I have to make $link code to open in new window (target=“_blank”) perhaps :)?
Snippet of the code I am dealing with:
[COLOR=“DarkRed”]if (!empty($business->linkto)) {
$new_link = $business->linkto;
$link = $new_link; //part where i need to get links open in new window
} else {
$link = JRoute::_( 'index.php?option=com_svmap&layout=business&business='.$business->id.'&name='.JFilterOutput::stringURLSafe($business->name) );
}[/COLOR]
-
I am using SVMap component (SVMap Google Map - Joomla! Extensions Directory) for Joomla and I am developing site for one condom wholesaler in Baltics, the website, where I need this function done is: [url=http://royalcondoms.eu/page/en/tartu]Tartu (click on the markers, which are on Google Maps - those has to be opened in new window)
-
I have searched a lot of forums to find solution for my issue, but no help, so I turned to you in hope somebody can help me out with this little issue.
-
Few codes I have found from other forums, which cpould be helpful for getting this issue solved:
1.) <?php
function n3y_url_shorten($url,$chr_limit = 30,$add = ‘…’) {
return preg_replace(“!(http:/{2}[\w\.]{2,}[/\w\-\.\?\&\=\#]*)!e”, “'<a href=\”\\1\" title=\“\\1\” target=\“_blank\”>‘.(strlen(’\\1’)>=$chr_limit ? substr(‘\\1’,0,$chr_limit).‘$add’:‘\\1’).‘</a>’", $url);
}
?>
2.) PHP Function to Auto Convert URL into Hyperlink | ZENVERSE
3.) [RESOLVED] preg_match and preg_replace - PHPBuilder.com
4.) PHP Tutorials Examples URL to Link
Thank you very much in advance, if there is anybody who can help me out with this issue…
If nobody can help me and I found answer for my issue before anybody else I will let you know immidiately
Best regards,
kjogiste