Created
December 22, 2008 17:28
-
-
Save ashgti/39062 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- $f = new form($this->parser, '/',$user) do | |
%p | |
= $f->input('name') | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class form { | |
protected $parser; | |
protected $object; | |
function __construct($parser, $url, $object) { | |
$this->parser = $parser; | |
$this->object = $object; | |
ob_start(); | |
$this->parser->setSource("%form\{:action=\"#\" :method=>\"post\" :accept-charset =>\"utf-8\"}")->display(); | |
} | |
function input($name) { | |
$parser_string = "%input\{:name => \"{$name}\""; | |
if ($this->object->get($name)) | |
$parser_string .= ' :value => "'.$this->object->get($name).'"'; | |
$parser_string .= '}'; | |
$this->parser->setSource($parser_string)->display(); | |
} | |
function __destruct() { | |
?> | |
<p><input type="submit" value="Continue →" /></p> | |
</form> | |
<?php | |
echo ob_get_clean(); | |
} | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form action="/" method="post" accept-charset="utf-8"> | |
<p> | |
<input name="name" value="<?php echo $user->get("name") ?>" /> | |
</p> | |
<p><input type="submit" value="Continue →" /></p> | |
</form> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment