KumbiaPHP beta2-dev
Framework PHP en español
tag.php
Ir a la documentación de este archivo.
00001 <?php
00024 class Tag
00025 {
00031     protected static $_css = array();
00032     
00039     public static function getAttrs($params)
00040     {
00041         $data = '';
00042         foreach($params as $k => $v) {
00043             $data .= " $k=\"$v\"";
00044         }
00045         return $data;
00046     }
00047     
00056     public static function create($tag, $content = NULL, $attrs = NULL) 
00057     {
00058         if(is_array($attrs)) {
00059             $attrs = self::getAttrs($attrs);
00060         }
00061 
00062         if(is_null($content)) {
00063             echo "<$tag $attrs />";
00064         }
00065 
00066         echo "<$tag $attrs>$content</$tag>";
00067     }
00068     
00075     public static function js($src, $cache = TRUE)
00076     {
00077         $src = "javascript/$src.js";
00078         if(!$cache) {
00079             $src .= '?nocache=' . uniqid();
00080         }
00081         
00082         return '<script type="text/javascript" src="' . PUBLIC_PATH . $src . '"></script>';
00083     }
00084     
00091     public static function css($src, $media = 'screen')
00092     {
00093         self::$_css[] = array('src' => $src, 'media' => $media);
00094     }
00095     
00101     public static function getCss()
00102     {
00103         return self::$_css;
00104     }
00105 }
 Todo Estructuras de Datos Namespaces Archivos Funciones Variables Enumeraciones