
01/04/2014, 21:36
|
| | Fecha de Ingreso: enero-2008
Mensajes: 581
Antigüedad: 17 años, 1 mes Puntos: 9 | |
Respuesta: Duda con POO Gracias por compartirme el manual @jheckson, he conseguido que me funcionase pero no se si es una sintaxis valida
class Alerta {
//success/info/warning/danger
private $alerta;
public function alert($style, $ttl, $msg, $close=null) {
if(isset($close)){$close="<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-hidden=\"true\">×</button>\n";}
echo $this->alerta="<div class=\"alert alert-$style alert-dismissable\">".$close."<strong>".ucwords($ttl)."! </strong> $msg</div>\n";
}
}
class Imagen extends Alerta {
//rounded/circle/thumbnail
private $imagen;
public function image($src, $style) {
echo $this->imagen="<img src=\"$src\" alt=\"...\" class=\"img-$style\">";
}
}
class Html extends Imagen {}
$Html=new Html();
$Html->alert('success','Éxito','Mensaje...','close');
$Html->image('https://www.google.es/images/srpr/logo11w.png','circle'); |