Jetzt sag nicht, dass Du SOWAS willst:
<?php
class emailInput {
protected $id;
protected $adresse;
protected $name;
function __construct( $name, $adresse ) {
$this -> name = $name;
$this -> adresse = $adresse;
$this -> id = uniqid('I');
}
function printout() {
ob_start();
?>
<p><label for="<?=$this->id;?>" >E-Mail <img id="email" class=help /></label>
<input required
type = 'email'
name = 'email'
title = 'email required'
maxlength = 100
value = '<?=$this->adresse;?>'
> <i class="em08 chblau">5 .. 100</i></p>
<?php
echo preg_replace('/\s+/', ' ', ob_get_clean() );
}
}
?>
<h1>HTML-Geraffel</h1>
<?php $o=new emailInput('email', 'foo@example.org'); $o->printout();?>
Also funktionieren tut sowas. (Wie ein Test beweisen könnte.)