Template code Chunk output
{#example_1}
{!-- Custom Template Providers (new in Chunk 2.2).
  --
  -- Check the NetTemplates.java source for a reference implementation
  -- of a custom template provider that loads its templates
  -- from a webserver.  Templates are cached for performance.
  --
  -- A real-world implementation might add automatic cache expiration,
  -- or might preload several templates at once from a zip.
  --
  -- A new custom template provider just needs to implement
  -- the com.x5.template.ContentSource interface.
  --
  -- String baseURL = "http://example.com/templates/"
  -- Theme theme = new Theme( new NetTemplates(baseURL) );
  -- Chunk c = theme.makeChunk("hello#net");
  -- html = c.toString();
  --}
<html>
 <head>
  <title>It came from the Net!</title>
 </head>
 <body>
  <div>
   It came from the {$what_kind:fabulous} 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>
{#}
import com.x5.template.Chunk;
import com.x5.template.Theme;
import com.x5.template.providers.NetTemplates;

//...

String baseURL = "http://example.com/templates/"
Theme theme = new Theme( new NetTemplates(baseURL) );

//
// Fetch the { #net } ... { # } subtemplate/snippet
// from http://example.com/templates/hello.chtml
//
Chunk c = theme.makeChunk("hello#net");
c.set("what_kind", "glorious");

html = c.toString();
<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>

It came from the Net!
It came from the glorious Net!