Template code Chunk output
  1. {#example_1}
  2. {!-- Custom Template Providers (new in Chunk 2.2).
  3. --
  4. -- Check the NetTemplates.java source for a reference implementation
  5. -- of a custom template provider that loads its templates
  6. -- from a webserver. Templates are cached for performance.
  7. --
  8. -- A real-world implementation might add automatic cache expiration,
  9. -- or might preload several templates at once from a zip.
  10. --
  11. -- A new custom template provider just needs to implement
  12. -- the com.x5.template.ContentSource interface.
  13. --
  14. -- String baseURL = "http://example.com/templates/"
  15. -- Theme theme = new Theme( new NetTemplates(baseURL) );
  16. -- Chunk c = theme.makeChunk("hello#net");
  17. -- html = c.toString();
  18. --}
  19. <html>
  20. <head>
  21. <title>It came from the Net!</title>
  22. </head>
  23. <body>
  24. <div>
  25. It came from the {$what_kind:fabulous} Net!
  26. </div>
  27.  
  28. <ul>
  29. <li>
  30. <a href="https://code.google.com/p/chunk-templates/source/browse/trunk/src/com/x5/template/providers/NetTemplates.java">
  31. NetTemplates.java
  32. </a>
  33. </li>
  34. <li>
  35. <a href="https://code.google.com/p/chunk-templates/source/browse/trunk/src/com/x5/template/providers/TemplateProvider.java">
  36. TemplateProvider.java
  37. </a>
  38. </li>
  39. </ul>
  40.  
  41. </body>
  42. </html>
  43. {#}
<html>
 <head>
  <title>It came from the Net!</title>
 </head>
 <body>
  <div>
   It came from the glorious Net!
  </div>

  <ul>
   <li>
    <a href="https://code.google.com/p/chunk-templates/source/browse/trunk/src/com/x5/template/providers/NetTemplates.java">
     NetTemplates.java
    </a>
   </li>
   <li>
    <a href="https://code.google.com/p/chunk-templates/source/browse/trunk/src/com/x5/template/providers/TemplateProvider.java">
     TemplateProvider.java
    </a>
   </li>
  </ul>

 </body>
</html>