• 0

Smarty PHP Template


Question

Im new using the Smarty's Php Template, so im looking for new plugins and found some in the smartys web page.. but what i dont know is how to implement them.. for example i downlaoded this one

function smarty_modifier_highlight_quoted($text, $escape = true, $indenter = '|>',$colors = false) 
{ 
    if(!is_array($colors)) { 
        $colors = array(); 
        $colors[] = "#000000"; 
        $colors[] = "#0000BB"; 
        $colors[] = "#681E80"; 
        $colors[] = "#0070FF"; 
        $colors[] = "#C67900"; 
        $colors[] = "#008800"; 
        $colors[] = "#FF3333"; 
    } 
  
  
    $matches = array(); 
  
    preg_match_all(	'/^([ '.preg_quote($indenter).']*)(.*)/m', 
        $text, 
        $matches, 
        PREG_SET_ORDER); 
  
    $ret = ""; 
  
    foreach($matches AS $match) { 
   	 if ($escape) { 
      $match[2]	=	htmlspecialchars($match[2]); 
   	 } 
   	 if(trim($match[2]) != "") { 
      $indent	=	strlen(preg_replace('/[\s]*/','',$match[1])); 
            $color  =	$indent % count($colors); 
  
            $ret   .=	'<font color="'.$colors[$color].'">'; 
            $ret   .=	htmlspecialchars($match[1])." "; 
            $ret   .=	$match[2]; 
            $ret   .=	"</font>"; 
   	 } else { 
      $ret   .=	$match[2]; 
   	 } 
    } 
  
    return $ret; 
} 
?>

But i dont know how to make it work!

Can any of you help me please???

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.