Skip to content

Commit

Permalink
Added support for less dynamic stylesheet language
Browse files Browse the repository at this point in the history
  • Loading branch information
fernandocarletti committed Jul 21, 2011
1 parent 8a6b0c4 commit 01fb6fe
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions plugins/function.stylesheet.php
@@ -1,18 +1,23 @@
<?php

function smarty_function_stylesheet($params, $template) {
$stylesheet_tag = "<link rel=\"stylesheet\"";
$stylesheet_tag = '<link rel="stylesheet"';

if($params['less'])
{
$stylesheet_tag = '<link rel="stylesheet/less"';
}

foreach($params as $key => $value) {
if(strtolower($key) == "src") {
$src = URL::base()."public/stylesheets/".$params["src"];
$stylesheet_tag .= " href=\"{$src}\" ";
if(strtolower($key) == 'src') {
$src = URL::base().'public/stylesheets/'.$params['src'];
$stylesheet_tag .= ' href="{$src}" ';
} else {
$stylesheet_tag .= " {$key}=\"{$value}\" ";
$stylesheet_tag .= ' {$key}="{$value}" ';
}
}

$stylesheet_tag .= "/>";
$stylesheet_tag .= '/>';

return $stylesheet_tag;
}
Expand Down

0 comments on commit 01fb6fe

Please sign in to comment.