<?
$url = "documentation.form2content.com/f2c-field-types/image-gallery-field";
function addhttp($url) {
if (!preg_match("~^(?:f|ht)tps?://~i", $url)) {
$url = "http://" . $url;
}
return $url;
}
$real_url = addhttp($url);
// Output $real_url = http://documentation.form2content.com/f2c-field-types/image-gallery-field
$domain = str_ireplace('www.', '', parse_url($real_url, PHP_URL_HOST));
// Output $domain = documentation.form2content.com
// JOOMLA
{php}
$url = str_ireplace('www.', '', parse_url('{$HYPERLINK}', PHP_URL_HOST));
echo '<a class="detail_list_item" href="{$HYPERLINK}" target="_blank">
<img src="templates/frontend/img/ico/link.png"/>
<div>'.$url.'</div>
</a>';
{/php}
Check for http:// in URL and get HOST for clean Anchor Links
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.