I have a text content object which contains Ivy macros like <%= in.abc.var%>. This content object is used as content in an email element with <%ivy.cms.co("...")%>. This works very good.

Now we want to do the same but call it with an external function which gets the subject and the content as an argument. But this leads to the following exception:

ch.ivyteam.ivy.macro.MacroException: Error during macro expansion: IvyScript Runtime Exception in Instruction: in.abc.var<br/>
    Block: in.abc.var<br/>
    at  ch.ivyteam.ivy.macro.internal.MacroExpander.expandMacros(MacroExpander.java:84)

Is there a possibility to evaluate a string that contains ivy macros like it was possible in Ivy 3.x?

asked 20.06.2013 at 10:19

Matthias%20Lang's gravatar image

Matthias Lang
(suspended)
accept rate: 0%


In Ivy 4+ you can use placeholders like {0} and {1} in your content objects. In ivy.cms.co() you then can pass a list of parameters that will replace the placeholders.

/MyContentObject = "My name is {0} and I am {1} years old."
ivy.cms.co("/MyContentObject", ["Michael", in.age])

Unfortunately we do not support the dedicated functions expand() and evaluate() like in 3.x .

link

answered 27.06.2013 at 10:44

Bruno%20B%C3%BCtler's gravatar image

Bruno Bütler
56181318
accept rate: 68%

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×26
×1

Asked: 20.06.2013 at 10:19

Seen: 2,163 times

Last updated: 20.06.2013 at 10:19