Created
January 13, 2012 16:05
-
-
Save Javlopez/1607217 to your computer and use it in GitHub Desktop.
Ejemplo de Clase estatica y como usarla
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Suma() | |
{ | |
public $sum; | |
public function addSumando($sum) | |
{ | |
$this->sum += $sum; | |
} | |
public function resultado() | |
{ | |
return $this->sum; | |
} | |
} | |
$suma = new Suma(); | |
$suma->addSumando(156); | |
echo $suma->resultado(); | |
?> | |
Assets | |
$assets = new Assets(); | |
$assets->style("blablala.css"); | |
Assets | |
$operacion = new Operacion | |
$operacion->suma(4,5,8); | |
Operacion::suma(4,5,6); | |
Assets::style(); | |
Assets::style("estilo2.css,blabla.css,bal.css"); | |
Assets::style(array("estilo3.css","blabl.css")); | |
Assets::$styles = array(); | |
Assets::$styles = array( | |
"estilo.css", | |
"estilo2.css", | |
"estilo3.css", | |
"blabla.css", | |
); | |
function styles() | |
{ | |
if(Kohana::$enviroment === ) | |
{ | |
/*foreach(Assets::style() as $style): | |
/* $styles .="" | |
/*endforeach; | |
$styles = implode(",",Assets::style()); | |
$styles = "/min?styles=".$styles; | |
//min | |
} | |
else | |
{ | |
$styles = ""; | |
foreach(Assets::style() as $style){ | |
$styles .= HTML::style($style).PHP_EOL; | |
} | |
} | |
return $styles; | |
} | |
----------------------------------- | |
<?php foreach(Assets::style() as $style): ?> | |
<?php echo HTML::style($style).PHP_EOL | |
<?php endforeach; ?> | |
<?php echo Assets::styles() ?> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment