<?php
/*
* Url plugin
* -------------------------------------------------------------
* File:     function.urlOutside.php
* Type:     function
* Name:     url
* Purpose:  outputs a complete href element
* Examples: 
* {url url="hello.php" name="Hello" status="Text for the status bar"} for normal text links
* {url src="images/hello.png" alt="hello" status="Text for the status bar"} for image links
* -------------------------------------------------------------
*/
function smarty_function_urlOutside($params, &$smarty)
{
    $url = $params["url"];
    if (substr($url, 0, 4) != 'http') {
    	$url = "http://".$url;
    }
    
    $title = isset($params["title"]) ? $params["title"] : "";
    
    $target = "";
    if (isset($params["target"])) {
  		$target = ' target="'.$params["target"].'" ';
    }
    
    if($url) {
       $html = "<a href=\"{$url}\" ".$target." title=\"{$title}\">";
    } else {
       $html = $url;
    }
    return $html;
}
?>