XingKai Zhang
XingKai Zhang

Reputation: 13

if freemarker could add extends feature?

some directive:

#extends, #block, #override, #super

for example, I have a layout template file,

base.ftl

<html>  
    <head>  
        <#block name="head">base_head_content</#block>  

    </head>  
    <body>  
        <#block name="body">base_body_content</#block>  

    </body>  
</html>

now, I write my page,

child.ftl

<@override name="body">  
    <div class='content'>  

        Powered By rapid-framework  
    </div>
    <@super/>  
</@override>  
<@extends name="base.ftl"/>  

Then, I have the following outputs,

<html>  
    <head>  
        base_head_content  
    </head>  

    <body>  
        <div class='content'>  

            Powered By rapid-framework  
        </div> 
        base_body_content 
    </body>  

</html>  

Isn't it a good idea?

Upvotes: 1

Views: 257

Answers (1)

ddekany
ddekany

Reputation: 31152

Is this this a question, or a request? I mean, StackOverflow is not a good place to do the last.

That FreeMarker doesn't support this kind of thing (unless you hack it together from custom directives, which is possible to an extent) is a well known problem. The only reason it doesn't support something like this (yet...) is simply the lack of development time.

Upvotes: 1

Related Questions