SourceForge has been redesigned. Learn more.

template syntax

  • Igor Seletskiy

    Igor Seletskiy - 2000-03-15


    There are exists a template library for java, called freemarker:
    it has functionality close to HTML-Templates, but the syntax is alitle bit more compact, and easier to read.
    Would would you think about creating a join project, that will support templates for both, java & perl languages? It will be very nice to have such template language.

    • Sam Tregar

      Sam Tregar - 2000-03-16

      I tend to think of HTML::Template's template syntax as a finished product.  Minor additions
      are made from time to time, but it's not something I'm interested in making major revisions
      to.  I've considered doing a Java version of HTML::Template, although I can't say I have
      any definite plans to do so.  Actually, I would probably do an Ada version first.

      Perhaps you could describe freemaker's syntax?  Your link isn't getting me to freemaker...


      • Igor Seletskiy

        Igor Seletskiy - 2000-03-16

        Sorry wrong link:

        basically syntax is very simple.

        ${name} - to display variable name.
        if name is a hash, you can access elements of hash
        by ${name.element_name} - and this can be any number of levels.
        if name is a list:
        <list name as element>
        will walk through the list.
        for conditional expressions:
        <if name == "something>

        and if you want to set value to local variable
        <assign name="value">

        there are also functions (or macros) in html
        <function name(param1,param2)>

        and methods (in java code) that can be accessed in html:

        Hope you will be interested, because this syntax is a little bit easier to read than the one in HTML::Template

        • Sam Tregar

          Sam Tregar - 2000-03-17

          Well, that looks nothing like HTML::Template.  I don't have any interest in supporting anything
          like that.  HTML::Template strives for a simple template syntax that is understandable by
          non-programmers.  I don't see that intention anywhere in the above syntax!  The use of ${}
          is clearly geared towards the eyes of Perl programmers.  I'm not saying that this system is
          bad - it's just not in any important way similar to HTML::Template.

          It is crucial that HTML::Template remain true to its goal of separating code from design.  Without
          that there is very little reason to support yet another templating system at all!




          • Igor Seletskiy

            Igor Seletskiy - 2000-03-22

            Its just sad that we have so many HTML template languages, that are not cross-language compatible. HTML Template has to many limitations, and kind
            of awkward. Yet the idea is good, and the ability to use shared memory should give nice performance. Maybe I will start this project by myself, since you are not interested. Yet I don't like writing parser/compiler by hand, and I don't know any parser generators for perl. Anyway if someone interested in creating template language that will support several development languages,
            email me at

            • Sam Tregar

              Sam Tregar - 2000-03-22

              I'm not sad about it, since I currently do all my development in Perl!  If I ever find myself developing HTML applications in something other than Perl maybe I'll go ahead and build
              a compatible version.  Feel free to make a version of HTML::Template in Java.  I see that as a worthwhile project, just not one I have any need for personally.

              I've never understood people who are angry about the proliferation of templating systems.  It's a wide need with many possible solutions...  No single system could possibly answer all needs, particularily when those needs include 'simplicity' and 'small size'!  This isn't the "wheel" of the proverb; it's more like the "car".


            • Michael Granger

              Michael Granger - 2000-04-12

              Just FYI -

              There are several good parser/lexer modules in the CPAN: Parse::Lex, Parse::Yapp, and Parse::RecDescent are all cool tools.


Log in to post a comment.