Helper modules can't be used in the Custom tags #103

Closed
ad1862 opened this Issue Apr 20, 2012 · 3 comments

3 participants

@ad1862

I need to create a widget, which consists of code (functions), and HTML.
To separate code and presentation, I put HTML into: /tag_html/widget.html, code into: /tag_modules/zzz_custom_tags.erl
and call from widget.html: {% widget_a foo="bar" %} or {% widget foo="bar" %}
Error!

How to create a Helper module without HTML?

What sense in the Custom tags? ErlyDTL's "include" tag does the same function:
{% Include "name_snippet.html" with person = "Jane" greeting = "Hello"%}

@rokob

From the API Guide:

The difference between using an "include" tag and custom tags is that "include" will have access to all variables currently in the caller's scope, whereas custom tags only have access to the variables explicitly passed in. (In addition, custom tags are compiled only once for the entire project, but included files are compiled for each template that includes it.)

@ad1862

imho, it's same:
{% foo bar=1 %}
{% Include "foo.html" with bar=1 only %}

What about main question ?

@evanmiller

This issue is fixed in master. Closing.

@evanmiller evanmiller closed this Jan 20, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment