Edición de «Ejemplo de web adaptada a moviles»
De KumbiaPHP Framework Wiki
Advertencia: no has iniciado sesión. Tu dirección IP se hará pública si haces cualquier edición. Si inicias sesión o creas una cuenta, tus ediciones se atribuirán a tu nombre de usuario, además de otros beneficios.
Puedes deshacer la edición. Antes de deshacer la edición, comprueba la siguiente comparación para verificar que realmente es lo que quieres hacer, y entonces guarda los cambios para así efectuar la reversión.
Revisión actual | Tu texto | ||
Línea 1: | Línea 1: | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== INTRODUCCION == | == INTRODUCCION == | ||
Línea 28: | Línea 22: | ||
{ | { | ||
public function index() | public function index() | ||
− | + | { | |
$this->mensaje = "Este mensaje se recibe desde el metodo ".$this->action_name." del controller ".$this->controller_name; | $this->mensaje = "Este mensaje se recibe desde el metodo ".$this->action_name." del controller ".$this->controller_name; | ||
$this->hora = date('Y-m-d'); | $this->hora = date('Y-m-d'); | ||
Línea 42: | Línea 36: | ||
</head> | </head> | ||
− | <body> | + | <body bgcolor="blue"> |
<h1>Contenido</h1> | <h1>Contenido</h1> | ||
<?php View::Content(); ?> | <?php View::Content(); ?> | ||
Línea 54: | Línea 48: | ||
<p>Hora: <?php echo $hora; ?></p> | <p>Hora: <?php echo $hora; ?></p> | ||
</source> | </source> | ||
− | |||
== PREPARANDO LOS CAMBIOS == | == PREPARANDO LOS CAMBIOS == | ||
− | Bien, lo primero que necesitamos para nuestra "web reducida" es una plantilla distinta. En nuestro caso de ejemplo será simple: he cambiado el color de fondo, quitado el H1 y ajustado el viewport | + | Bien, lo primero que necesitamos para nuestra "web reducida" es una plantilla distinta. En nuestro caso de ejemplo será simple: he cambiado el color de fondo, quitado el H1 y ajustado el viewport. |
'''/app/views/templates/mobile.phtml''' | '''/app/views/templates/mobile.phtml''' | ||
Línea 64: | Línea 57: | ||
<html> | <html> | ||
<head> | <head> | ||
− | <title>Plantilla por defecto para | + | <title>Plantilla por defecto para movil</title> |
− | |||
</head> | </head> | ||
− | <body> | + | <body bgcolor="gray"> |
− | < | + | <b>Contenido</b> |
<?php View::Content(); ?> | <?php View::Content(); ?> | ||
</body> | </body> | ||
Línea 80: | Línea 72: | ||
'''/app/views/test/mobile/index.phtml''' | '''/app/views/test/mobile/index.phtml''' | ||
<source lang=php> | <source lang=php> | ||
− | < | + | <b>Mensaje:</b> <?php echo $mensaje; ?><br /> |
− | < | + | <b>Hora:</b> <?php echo $hora; ?> |
− | < | + | <i>Esta pagina esta optimizada para dispositivos moviles</i> |
</source> | </source> | ||
+ | |||
== LIBRERIA AUXILIAR == | == LIBRERIA AUXILIAR == | ||
Línea 93: | Línea 86: | ||
<?php | <?php | ||
class Mobile { | class Mobile { | ||
− | public | + | public function mobileURL() { |
// Lista de URLs | // Lista de URLs | ||
$mobile_urls = array( "m.example.com", "mobile.example.com" ); | $mobile_urls = array( "m.example.com", "mobile.example.com" ); | ||
Línea 101: | Línea 94: | ||
} | } | ||
− | public | + | public function mobileBrowser() { |
$mobile_browser = '0'; | $mobile_browser = '0'; | ||
Línea 171: | Línea 164: | ||
$this->set_response("mobile"); | $this->set_response("mobile"); | ||
} | } | ||
− | |||
} | } | ||
</source> | </source> | ||
Línea 195: | Línea 187: | ||
$this->set_response("mobile"); | $this->set_response("mobile"); | ||
} | } | ||
− | |||
} | } | ||
− | |||
</source> | </source> | ||