Hi all

i'm trying to use cms inside another cms, i have a cms structure as below (i use insert cms marcro from ivy): alt text so i create a Ivy project then try to get this cms inside html dialog, everything work fine. But if i get that cms in java/ivy script then the cms of second level is not evaluated correctly, it's still a marco, even i show this on screen. alt text What is different of two ways here?

asked 21.11.2016 at 11:58

trungdv's gravatar image

trungdv
(suspended)
accept rate: 52%

edited 21.11.2016 at 11:59


It's correct that embedded macro are only expanded in a JSP or JSF context.

If you require embedded macro expansion in Java/IvyScript you can do that by using internal API. The following sample util expands embedded macros:

public class CmsExpanderUtil {

    public static String expand(String cmsTemplate)
    {
        IEmbeddedScriptExpander scriptExpander = EmbeddedScriptExpanderFactory.createExpander();
        try {
            return scriptExpander.expandEmbeddedScripts(cmsTemplate, 
                    Ivy.request().getContext(null), Ivy.request().getProject().getIvyScriptEngine(), false, 50);
        } catch (PersistencyException | EnvironmentNotAvailableException
                | IvyScriptException e) {
            return cmsTemplate;
        }
    }

}
link

answered 23.11.2016 at 11:23

Reguel%20Wermelinger's gravatar image

Reguel Werme... ♦♦
9.4k31958
accept rate: 70%

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

Asked: 21.11.2016 at 11:58

Seen: 1,724 times

Last updated: 23.11.2016 at 11:23