text = $text; } public function render() { // here one could add some translation functionality.. return "{$this->text}
"; } } class NameForm extends ezcWgFormWidget { private $result = null; public function __construct( $parent ) { parent::__construct( $parent ); } public function render() { $result = ""; if( $this->result === null ) { $widget = new TextWidget( $this, "Enter your name:" ); $header = "
method}\">"; $children = parent::render(); $line = "
"; $button = ""; $footer = "
"; $result = $header . $children . $line . $button . $footer; } else { $result = "Your name is {$this->result}"; } return $result; } public function handleEvent( ezcWgEvent $e ) { if( $e instanceof ezcWgFormEvent && isset( $_POST['okButton'] ) ) { // check if name is there $this->result = $_POST["name"]; $e->accept(); } } } class MainPage extends ezcWgWidget { public function __construct( $parent ) { parent::__construct( $parent ); } public function render() { return "" . parent::render() . ""; } } $main = new MainPage( null ); $formWidget = new NameForm( $main ); $app = ezcWgApplication::getInstance(); $app->setMainWidget( $main ); $app->run(); ?>