Ver Mensaje Individual
  #13 (permalink)  
Antiguo 23/12/2012, 19:57
underwebinfo
 
Fecha de Ingreso: septiembre-2012
Ubicación: Buenos aires
Mensajes: 110
Antigüedad: 11 años, 6 meses
Puntos: 9
Respuesta: Class var en eval

recién lo hice y funciona perfecto absolutamente todo perfecto , vos sos brujo ¬¬ yo ya lo habia echo y no me funcionaba T.T


Acá esta la clase completa y funcionando:
Código PHP:
Ver original
  1. # --- Paginador
  2. class Cm_Paginador{
  3.    
  4.     # --- Configuracion
  5.     var $Posicion,$Botones,$Base,$Article,$Order,$Mysql,$Query,$Exect,$Cant,$Paginas,$Comming,$Consulta,$Estructura;
  6.    
  7.     # --- Mysql
  8.     public function _Mysql($Mysql,$base,$article,$orden,$Posicion){
  9.        
  10.         # --- Mysql
  11.         $this->Base  = $base;
  12.         $this->Order = $orden;
  13.         $this->Article = $article;
  14.         $this->Mysql    = $Mysql;
  15.         $this->Posicion = $Posicion;
  16.         $this->Mysql->Conectar();
  17.         $this->Query = "SELECT * FROM ".($this->Base);
  18.         $this->Exect = $this->Mysql->Consulta($this->Query);
  19.        
  20.         # --- Condicionales
  21.         $this->Cant     = $this->Mysql->Reg_Num($this->Exect);
  22.         $this->Paginas  = ceil($this->Cant/$this->Article);
  23.         $this->Comming  = $this->Article*$this->Posicion;
  24.         $Desde          = $this->Posicion*$this->Paginas;
  25.    
  26.         # --- Consulta
  27.         $this->Consulta = $this->Mysql->Consulta($this->Query.' ORDER BY id '.$orden.' LIMIT '.$Desde.' , '.$this->Cant);
  28.    
  29.     }
  30.    
  31.     # --- Estructura
  32.     public function _Estructure($estructure){
  33.        
  34.         $this->Estructura = $estructure;
  35.        
  36.     }
  37.    
  38.     # --- Devolucion
  39.     public function _Devolucion(){
  40.        
  41.                
  42.         while($Campo = $this->Mysql->Assoc($this->Consulta)){
  43.            
  44.             $str = $this->Estructura;  
  45.            
  46.             foreach($Campo as $clave => $valor) {
  47.                    
  48.                 $str = str_replace('{'.$clave.'}',$valor,$str);
  49.                
  50.                
  51.             }
  52.            
  53.             echo $str;
  54.  
  55.         }
  56.        
  57.  
  58.     }
  59.    
  60.     # --- Navegacion
  61.     public function _Navegacion($botones){
  62.        
  63.         # Vars
  64.         $this->Botones = $botones;
  65.        
  66.         if(($this->Botones)>=3){
  67.            
  68.             // next
  69.             if(($this->Posicion)>1 && ($this->Paginas)>1){
  70.                
  71.                 echo '<input type="button" onClick="Paginacion('.(($this-Posicion)-1).')" value="next">';
  72.                
  73.             }
  74.            
  75.             // numbers
  76.             for($i = 1;$i<$this->Botones;$i++){
  77.            
  78.                 if($i<$this->Paginas){
  79.                    
  80.                     echo '<input type="button" value="'.$i.'" onClick="Paginacion('.$i.')">';
  81.                        
  82.                 }
  83.            
  84.             }
  85.            
  86.             // prev
  87.             if(($this->Posicion)<($this->Paginas)){
  88.                
  89.                 echo '<input type="button" onClick="Paginacion('.(($this->Posicion)+1).')" value="prev">';
  90.                
  91.             }
  92.    
  93.         }
  94.        
  95.         if(($this->Botones)<=2){
  96.        
  97.                    
  98.             // next
  99.             if(($this->Posicion)>1 && ($this->Paginas)>1){
  100.                
  101.                 echo '<input type="button" onClick="Paginacion('.(($this->Posicion)-1).')" value="next">';
  102.                    
  103.             }
  104.    
  105.             // prev
  106.             if(($this->Posicion)<($this->Paginas)){
  107.                    
  108.                 echo '<input type="button" onClick="Paginacion('.(($this->Posicion)+1).')" value="prev">';
  109.                    
  110.             }
  111.                            
  112.         }
  113.        
  114.     }
  115.    
  116. }


Su forma de uso

Código PHP:
Ver original
  1. # --- Posicion
  2.     if(isset($_POST['Page']) && $_POST['Page']==''){
  3.        
  4.         $Posicion = intval($_POST['Page']);
  5.    
  6.     }else{
  7.        
  8.         $Posicion = 1;
  9.  
  10.     }
  11.  
  12.     # --- Configuracion
  13.     $Paginador  = new Cm_Paginador;
  14.     $Paginador->_Mysql(new Cm_mysql,'Album',5,'DESC',$Posicion);
  15.  
  16.     # --- Estructura
  17.     $Estructure = '<li><article class="Info"><h1><img src="Content/Albums/{Slug}/{Caratula}">{Titulo}</h1><p>{Pie}</p></article><article class="Multimedia" id="Album_{id}"><a href="http://Naylafernandez.com.ar/Album/{Slug}/" target="new" class="Ver" title="Ver Album"></a> <input type="button" title="Agregar Fotos" class="Agregar"> <input type="button" title="Editar Album" class="Editar"> <input type="button" title="Eliminar Album" class="Eliminar"></article></li>';
  18.     $Paginador->_Estructure($Estructure);
  19.      
  20.     # --- Devolucion
  21.     $Paginador->_Devolucion();
  22.    
  23.     # --- Paginacion
  24.     $Paginador->_Navegacion(5);

Esta imagen es para vos @David, y gracias @pateketrueke por contestar también me ayudaron mucho ñ.ñ

Última edición por underwebinfo; 07/01/2013 a las 03:19