Advertisement
Guest User

Untitled

a guest
Feb 24th, 2010
297
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. <?php
  2.  
  3. /*
  4.  
  5. desired outcome:
  6.  
  7. <html>
  8. <body>
  9. <m:header title="this is the page"/>
  10. <m:commentForm uid="{$uid}"/>
  11. <span>
  12. <m:confirmButton auth="email,stream_publish"/>
  13. </span>
  14. <span>
  15. <m:cancelButton dialog="1" title="error" message="are you sure you want to cancel?"/>
  16. </span>
  17. <m:footer/>
  18. </body>
  19. </html>
  20. */
  21.  
  22. require './php-lib/init.php';
  23.  
  24. class :fb:commentForm extends :x:element {
  25. attribute
  26. string author = "Anonymous",
  27. string message = "Blank";
  28.  
  29. protected function render() {
  30. return <div class="commentForm"><h2>Author: {$this->getAttribute('author')}</h2><p>{$this->getAttribute('message')}</p></div>;
  31. }
  32. }
  33.  
  34. $who = duder;
  35. $message = "They're watching me!";
  36.  
  37. echo <fb:commentForm author={$who} message={$message}/>;
  38.  
  39. echo <html>
  40. <body>
  41. <h1>A comment form</h1>
  42. <fb:commentForm author={$who} message={$message}/>
  43. </body>
  44. </html>;
  45.  
  46. $commentForm = <fb:commentForm author={$who} message={$message}/>;
  47.  
  48. echo <html>{$commentForm}</html>;
  49.  
  50. ?>
  51.  
  52. produces the following:
  53.  
  54. <div class="commentForm"><h2>Author: duder</h2><p>They're watching me!</p></div><br />
  55. <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 />
  56.  
  57.  
  58.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement