javascript template: how to include another template? | Community
Skip to main content
November 21, 2022
Question

javascript template: how to include another template?

  • November 21, 2022
  • 1 reply
  • 1370 views

I guess what I am looking for is similar to the "include view" in the personalization step, but I can not find my way in the documentation. Unlike include view, I have content A including the id of Content B, and I want the template for content A to run and include the template of content B NOT in the personalization step but in the first run. I do this from a jssp-page with TransformFromId using ncm.publishing, but how can I achive this in the javascript template?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

Marcel_Szimonisz
Community Advisor
Community Advisor
November 27, 2022

Hello @rbe_jonas 

This JSSP contents are saved as delivery templates? Can you elaborate more what you want to achieve?
You want to include another JSSP page? you can do that from JSSP to include another page?

 

Marcel Szimonisz

MarTech Consultant
for more tips visit my blog
https://www.martechnotes.com/

RBE_jonasAuthor
November 27, 2022

Hi Marcel, thank you for picking this up!

 

So, I'm setting up a content template, where the content contains ids of other contents, used like blocks; so one block can be reused and included in several contents together with other blocks like a parent containing several children.

 

I have one template for the parents, and one template for the children. The children template works fine, but in the parent template I would like to call the children template with the child-id, and get a transformed result. Like you can do in JSSP with transformFromId but it is not available in templates.

 

Now I have to have the template load the cild-content, and parse it using functions in the parent template. These functions are already defined in the child-template and keeping them both updated so they look the same is a hassle.

 

Hopes that makes it clear, but please feel free to inquery further if I can be any clearer.

 

Marcel_Szimonisz
Community Advisor
Community Advisor
November 27, 2022

This is for JSSP pages right? 

I have found this JSSP might be useful for you 
xtk:themePreview.jssp

They simply inject formPreview  item into the html content

 

Marcel


no its just adding preview thumbnail 🙂