Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- desired outcome:
- <html>
- <body>
- <m:header title="this is the page"/>
- <m:commentForm uid="{$uid}"/>
- <span>
- <m:confirmButton auth="email,stream_publish"/>
- </span>
- <span>
- <m:cancelButton dialog="1" title="error" message="are you sure you want to cancel?"/>
- </span>
- <m:footer/>
- </body>
- </html>
- */
- require './php-lib/init.php';
- class :fb:commentForm extends :x:element {
- attribute
- string author = "Anonymous",
- string message = "Blank";
- protected function render() {
- return <div class="commentForm"><h2>Author: {$this->getAttribute('author')}</h2><p>{$this->getAttribute('message')}</p></div>;
- }
- }
- $who = duder;
- $message = "They're watching me!";
- echo <fb:commentForm author={$who} message={$message}/>;
- echo <html>
- <body>
- <h1>A comment form</h1>
- <fb:commentForm author={$who} message={$message}/>
- </body>
- </html>;
- $commentForm = <fb:commentForm author={$who} message={$message}/>;
- echo <html>{$commentForm}</html>;
- ?>
- produces the following:
- <div class="commentForm"><h2>Author: duder</h2><p>They're watching me!</p></div><br />
- <b>Fatal error</b>: Method xhp_html::__toString() must not throw an exception in <b>/home/modetwo/public_html/xhp/fb.php</b> on line <b>0</b><br />
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement