Created
April 14, 2011 02:45
-
-
Save alganet/918807 to your computer and use it in GitHub Desktop.
Requirements for a next-gen HTML templating engine.
This file contains hidden or 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
| <!doctype html> | |
| <html> | |
| <head> | |
| <title>Hi</title> | |
| <script id="helloworld" type="text/html"> | |
| Hello <strong>${user}</strong> | |
| </script> | |
| <script id="secretTemplate" type="text/html" class="php-only"> | |
| Sensitive Info! | |
| </script> | |
| </head> | |
| <body> | |
| </body> | |
| </html> |
This file contains hidden or 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 | |
| //Heavily based on and designed to be compatible with jQuery Templates | |
| //See: http://github.com/jquery/jquery-tmpl | |
| $template = new Template(); | |
| $template->loadFile('template.html'); | |
| $data = array("user" => "Alexandre"); | |
| $template("#helloworld")->tmpl($data)->appendTo($template("body")); | |
| echo $template->render(); |
This file contains hidden or 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
| <!doctype html> | |
| <html> | |
| <head> | |
| <title>Hi</title> | |
| <script id="helloworld" type="text/html"> | |
| Hello <strong>${user}</strong> | |
| </script> | |
| </head> | |
| <body> | |
| Hello <strong>Alexandre</strong> | |
| </body> | |
| </html> |
Author
@dublado provavelmente o padrão do jquery-templates seria seguido: http://api.jquery.com/template-tag-each/
Serviu perfeitamente!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Alguma idéia para blocos que devem ter estrutura de repetição ?