Ver Mensaje Individual
  #5 (permalink)  
Antiguo 21/02/2012, 12:40
starlightphp
Invitado
 
Mensajes: n/a
Puntos:
Respuesta: variables tipo clase

Cita:
Iniciado por jotaincubus Ver Mensaje
Creo que lo que buscas es el patrón de diseño Singleton
entonces, si yo en mi mismo archivo por ejemplo, pongo:

Código PHP:
<?php
    
require_once ($_SERVER['DOCUMENT_ROOT'].'/es/framework/classes/'.'UIProvider.php');    
class 
UIModules{
    static private 
$UIProvider_Object NULL;

   private function 
__construct() {}

    static public function 
UIProvider_Object() {
       if (
self::$UIProvider_Object== NULL) {
          
self::$UIProvider_Object= new UIModules();
       }
       return 
self::$instancia;
    }

static function 
ComboBox_Login(){ //Charge the combo box
        
$paises simplexml_load_file('../es/framework/documents/Countries_Spanish.xml');  
        
$j=1;
        
$print='<select id="Login_Register_Country" style="width:250; height:35">';
        foreach (
$paises as $pais){ 
            
$print.="<option value=".$j.">".$pais[0]."</option>\n"
            
$j++;
        } 
        
$print.="</select><br>"
        echo 
$print;
    }
con esto ya podría hacer por ejemplo:

Código PHP:
$inst2 UIProvider_Object::ComboBox_Login(); 
?