Custom Macros in ScreenHTMLMacros.html.ftl

2011-12-12
2012-09-09
  • I have added some custom macros in ScreenHtmlMacros.html.ftl for general use
    across the component. However, I am not able to to access it inside the ftl
    templates in the application using the <@macro /> syntax. I am not sure, if it
    is a namespace issue, or something else. I see that the
    ScreenHtmlMacros.html.ftl file is certainly getting "auto" included in all the
    output templates, but, I am not able to get the macros running. Has anybody
    else also faced the same (or similar) problem?

     
  • David E. Jones
    David E. Jones
    2011-12-13

    This won't work because it's not meant to work that way.

    The screen/form/etc rendering is in a separate context from any FTL templates
    you might include in the screen in order to avoid name and variable space
    conflicts.

    If you want macros that are available in your FTL templates you should include
    them in the desired FTL templates (you can use the component:// and other
    Moqui-specific URLs for this).